diff options
author | Micael Karlberg <[email protected]> | 2012-03-20 10:54:59 +0100 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2012-03-20 10:54:59 +0100 |
commit | d25cb373c7046eeadce5fffe7ab8301d8c03d647 (patch) | |
tree | 7de1bec1cf7fe582ab5c66baa0513d732b24d2da /lib/snmp/src/agent/snmp_standard_mib.erl | |
parent | 787ce33c1139233f8dfb90c4f1b6caeb3df7940a (diff) | |
parent | da92034283c1813d6d06feb39f064d7d8f76f951 (diff) | |
download | otp-d25cb373c7046eeadce5fffe7ab8301d8c03d647.tar.gz otp-d25cb373c7046eeadce5fffe7ab8301d8c03d647.tar.bz2 otp-d25cb373c7046eeadce5fffe7ab8301d8c03d647.zip |
Merge branch 'bmk/snmp/snmp422_integration/r15' into maint
Diffstat (limited to 'lib/snmp/src/agent/snmp_standard_mib.erl')
-rw-r--r-- | lib/snmp/src/agent/snmp_standard_mib.erl | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/lib/snmp/src/agent/snmp_standard_mib.erl b/lib/snmp/src/agent/snmp_standard_mib.erl index b6834d278c..ca93546923 100644 --- a/lib/snmp/src/agent/snmp_standard_mib.erl +++ b/lib/snmp/src/agent/snmp_standard_mib.erl @@ -143,20 +143,35 @@ do_reconfigure(Dir) -> %% Func: read_standard/1 %% Args: Dir is the directory with trailing dir_separator where %% the configuration files can be found. -%% Purpose: Reads th standard configuration file. +%% Purpose: Reads the standard configuration file. %% Returns: A list of standard variables %% Fails: If an error occurs, the process will die with Reason %% configuration_error. +%% This file is mandatory, as it contains mandatory +%% config options for which there are no default values. %%----------------------------------------------------------------- read_standard(Dir) -> ?vdebug("check standard config file",[]), - Gen = fun(_) -> ok end, - Filter = fun(Standard) -> sort_standard(Standard) end, - Check = fun(Entry) -> check_standard(Entry) end, + FileName = "standard.conf", + Gen = fun(D, Reason) -> + throw({error, {failed_reading_config_file, + D, FileName, + list_dir(Dir), Reason}}) + end, + Filter = fun(Standard) -> sort_standard(Standard) end, + Check = fun(Entry) -> check_standard(Entry) end, [Standard] = - snmp_conf:read_files(Dir, [{Gen, Filter, Check, "standard.conf"}]), + snmp_conf:read_files(Dir, [{Gen, Filter, Check, FileName}]), Standard. +list_dir(Dir) -> + case file:list_dir(Dir) of + {ok, Files} -> + Files; + Error -> + Error + end. + %%----------------------------------------------------------------- %% Make sure that each mandatory standard attribute is present, and @@ -548,6 +563,7 @@ snmp_set_serial_no(set, NewVal) -> snmp_generic:variable_func(set, (NewVal + 1) rem 2147483648, {snmpSetSerialNo, volatile}). + %%----------------------------------------------------------------- %% This is the instrumentation function for sysOrTable %%----------------------------------------------------------------- @@ -588,4 +604,4 @@ error(Reason) -> throw({error, Reason}). config_err(F, A) -> - snmpa_error:config_err("[STANDARD-MIB]: " ++ F, A). + snmpa_error:config_err("[STANDARD-MIB] " ++ F, A). |