summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Options.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2013-02-13 16:08:08 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-02-14 15:12:49 -0500
commitf91163abed4aa739f7f8b772eabb403f01b94a88 (patch)
tree356a3b99b5142f8d1c31749290606d4c290443fa /src/lib/Bcfg2/Options.py
parentad66b2e22eb64299d2f4dcd29e15e7083887813f (diff)
downloadbcfg2-f91163abed4aa739f7f8b772eabb403f01b94a88.tar.gz
bcfg2-f91163abed4aa739f7f8b772eabb403f01b94a88.tar.bz2
bcfg2-f91163abed4aa739f7f8b772eabb403f01b94a88.zip
extended usage of Executor class, added client-side timeout options
Diffstat (limited to 'src/lib/Bcfg2/Options.py')
-rw-r--r--src/lib/Bcfg2/Options.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/lib/Bcfg2/Options.py b/src/lib/Bcfg2/Options.py
index fe9a480a4..3f4e9a83c 100644
--- a/src/lib/Bcfg2/Options.py
+++ b/src/lib/Bcfg2/Options.py
@@ -334,6 +334,16 @@ def get_bool(val):
raise ValueError("Not a boolean value", val)
+def get_timeout(val):
+ """ convert the timeout value into a float or None """
+ if val is None:
+ return val
+ timeout = float(val) # pass ValueError up the stack
+ if timeout <= 0:
+ return None
+ return timeout
+
+
def get_size(value):
""" Given a number of bytes in a human-readable format (e.g.,
'512m', '2g'), get the absolute number of bytes as an integer """
@@ -801,6 +811,16 @@ CLIENT_EXIT_ON_PROBE_FAILURE = \
long_arg=True,
cf=('client', 'exit_on_probe_failure'),
cook=get_bool)
+CLIENT_PROBE_TIMEOUT = \
+ Option("Timeout when running client probes",
+ default=None,
+ cf=('client', 'probe_timeout'),
+ cook=get_timeout)
+CLIENT_COMMAND_TIMEOUT = \
+ Option("Timeout when client runs other external commands (not probes)",
+ default=None,
+ cf=('client', 'command_timeout'),
+ cook=get_timeout)
# bcfg2-test and bcfg2-lint options
TEST_NOSEOPTS = \
@@ -1131,7 +1151,9 @@ CLIENT_COMMON_OPTIONS = \
serverCN=CLIENT_SCNS,
timeout=CLIENT_TIMEOUT,
decision_list=CLIENT_DECISION_LIST,
- probe_exit=CLIENT_EXIT_ON_PROBE_FAILURE)
+ probe_exit=CLIENT_EXIT_ON_PROBE_FAILURE,
+ probe_timeout=CLIENT_PROBE_TIMEOUT,
+ command_timeout=CLIENT_COMMAND_TIMEOUT)
CLIENT_COMMON_OPTIONS.update(DRIVER_OPTIONS)
CLIENT_COMMON_OPTIONS.update(CLI_COMMON_OPTIONS)