summaryrefslogtreecommitdiff
path: root/lib/custodian/settings.rb
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2013-05-15 13:00:08 +0100
committerSteve Kemp <steve@steve.org.uk>2013-05-15 13:00:08 +0100
commit5ece9a9f52b3a450f9c15eda419102e05725f42f (patch)
tree134eda216d51528fe5362f8b10ca520cb0a08832 /lib/custodian/settings.rb
parent22c1f94f6f4ac1feb9bf55bcbc26c5a3d34077ed (diff)
Added store() method for use by test case.
updated comments.
Diffstat (limited to 'lib/custodian/settings.rb')
-rw-r--r--lib/custodian/settings.rb33
1 files changed, 24 insertions, 9 deletions
diff --git a/lib/custodian/settings.rb b/lib/custodian/settings.rb
index 310de02..1efabf6 100644
--- a/lib/custodian/settings.rb
+++ b/lib/custodian/settings.rb
@@ -3,7 +3,8 @@ require 'singleton'
#
-# A class which encapsulates some global-settings from the custodian configuration file.
+# A class which encapsulates some global-settings which are read from the
+# global configuration file.
#
# The configuration file is optional, and we have defaults for every value.
#
@@ -34,14 +35,14 @@ module Custodian
#
# Load the configuration file; called only once.
#
- def _load
+ def _load( file = "/etc/custodian/custodian.cfg" )
+
@parsed = true
@settings = Hash.new()
#
# The global configuration file.
#
- file = "/etc/custodian/custodian.cfg"
return unless( File.exists?( file ) )
#
@@ -60,6 +61,15 @@ module Custodian
end
+ #
+ # Privately set the value for a named key.
+ #
+ # Used by the test-suite.
+ #
+ def _store( key, val )
+ @settings[key] = val
+ @parsed = true
+ end
#
@@ -80,19 +90,19 @@ module Custodian
#
- # The timeout period for all tests
+ # The timeout period for each individual test.
#
def timeout
_load() unless( _loaded? )
- @settings['timeout'] || 30
+ @settings['timeout'].to_i || 30
end
#
- # The number of times to re-execute a test before
- # considering it is failed.
+ # The number of times to re-execute a failing test
+ # before raising an alert.
#
def retries
_load() unless( _loaded? )
@@ -102,7 +112,13 @@ module Custodian
#
- # Should we sleep before repeating tests?
+ # When a test fails we repeat it up to five times.
+ #
+ # (The retries() method will return the number of repeats, but we default to five.)
+ #
+ # Here we configure a delay between those repeats.
+ #
+ # A delay of zero is permissable.
#
def retry_delay
_load() unless( _loaded? )
@@ -132,7 +148,6 @@ module Custodian
-
#
# The filename for the logfile.
#