diff options
author | Micael Karlberg <[email protected]> | 2012-02-27 16:09:38 +0100 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2012-02-27 16:09:38 +0100 |
commit | a05886528ce9a02a79eda82c8868f489dd478aaa (patch) | |
tree | a8060cb88342da0816c54a40cd3d7c1b6f516661 /lib/snmp/src/agent/snmp_community_mib.erl | |
parent | f6b7aade87b64c4c60eba65dfac6310a8c7bf139 (diff) | |
parent | d11e013575ed400b7167342be4b08ba3d1166ee9 (diff) | |
download | otp-a05886528ce9a02a79eda82c8868f489dd478aaa.tar.gz otp-a05886528ce9a02a79eda82c8868f489dd478aaa.tar.bz2 otp-a05886528ce9a02a79eda82c8868f489dd478aaa.zip |
Merge branch 'bmk/snmp/improve_error_handling_reading_config/OTP-9943' into bmk/snmp/snmp422_integration/r15
Conflicts:
lib/snmp/doc/src/notes.xml
lib/snmp/src/app/snmp.appup.src
Diffstat (limited to 'lib/snmp/src/agent/snmp_community_mib.erl')
-rw-r--r-- | lib/snmp/src/agent/snmp_community_mib.erl | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/snmp/src/agent/snmp_community_mib.erl b/lib/snmp/src/agent/snmp_community_mib.erl index 77307aa7ad..d7d41aca31 100644 --- a/lib/snmp/src/agent/snmp_community_mib.erl +++ b/lib/snmp/src/agent/snmp_community_mib.erl @@ -28,6 +28,7 @@ -export([add_community/5, add_community/6, delete_community/1]). -export([check_community/1]). +-include("snmpa_internal.hrl"). -include("SNMP-COMMUNITY-MIB.hrl"). -include("SNMP-TARGET-MIB.hrl"). -include("SNMPv2-TC.hrl"). @@ -120,10 +121,17 @@ init_tabs(Comms) -> read_community_config_files(Dir) -> ?vdebug("read community config file",[]), - Gen = fun(_) -> ok end, - Filter = fun(Comms) -> Comms end, - Check = fun(Entry) -> check_community(Entry) end, - [Comms] = + FileName = "community.conf", + Gen = fun(D, Reason) -> + warning_msg("failed reading config file ~s" + "~n Config Dir: ~s" + "~n Reason: ~p", + [FileName, D, Reason]), + ok + end, + Filter = fun(Comms) -> Comms end, + Check = fun(Entry) -> check_community(Entry) end, + [Comms] = snmp_conf:read_files(Dir, [{Gen, Filter, Check, "community.conf"}]), Comms. @@ -601,5 +609,8 @@ set_sname(_) -> %% Keep it, if already set. error(Reason) -> throw({error, Reason}). +warning_msg(F, A) -> + ?snmpa_warning("[COMMUNITY-MIB]: " ++ F, A). + config_err(F, A) -> snmpa_error:config_err("[COMMUNITY-MIB]: " ++ F, A). |