aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src/agent/snmp_standard_mib.erl
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2012-02-24 15:29:04 +0100
committerMicael Karlberg <[email protected]>2012-02-24 15:29:04 +0100
commit92e37200fdfba41a625615b5b8e8308e363393aa (patch)
tree8dc6fbc743008403083062b0936099b907ae5c1d /lib/snmp/src/agent/snmp_standard_mib.erl
parent045810f873df73a09b105d051eed244be2edf7ee (diff)
downloadotp-92e37200fdfba41a625615b5b8e8308e363393aa.tar.gz
otp-92e37200fdfba41a625615b5b8e8308e363393aa.tar.bz2
otp-92e37200fdfba41a625615b5b8e8308e363393aa.zip
[snmp/agent] Improve error handling while reading agent config files
Improve error handling while reading agent config files. OTP-9943
Diffstat (limited to 'lib/snmp/src/agent/snmp_standard_mib.erl')
-rw-r--r--lib/snmp/src/agent/snmp_standard_mib.erl17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/snmp/src/agent/snmp_standard_mib.erl b/lib/snmp/src/agent/snmp_standard_mib.erl
index b6834d278c..7db94e7bd5 100644
--- a/lib/snmp/src/agent/snmp_standard_mib.erl
+++ b/lib/snmp/src/agent/snmp_standard_mib.erl
@@ -143,18 +143,24 @@ 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, 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.
@@ -548,6 +554,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
%%-----------------------------------------------------------------