diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-06-19 11:04:42 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-06-19 11:04:42 -0700 |
commit | 50ec3b78686ae812c44b22835bf1203c92f5e5e3 (patch) | |
tree | 2581b5b0e24c803def3b3accafa2ed3981f7b52d /cloudinit/helpers.py | |
parent | 2d3dcfb5ffb7714dadb6d317f2c2675faf3e1845 (diff) | |
download | vyos-cloud-init-50ec3b78686ae812c44b22835bf1203c92f5e5e3.tar.gz vyos-cloud-init-50ec3b78686ae812c44b22835bf1203c92f5e5e3.zip |
1. When running, return the function results as well as a boolean that stated if it ran.
Diffstat (limited to 'cloudinit/helpers.py')
-rw-r--r-- | cloudinit/helpers.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/cloudinit/helpers.py b/cloudinit/helpers.py index e5c45632..3fd819b3 100644 --- a/cloudinit/helpers.py +++ b/cloudinit/helpers.py @@ -150,7 +150,7 @@ class Runners(object): args = [] if sem.has_run(name, freq): LOG.info("%s already ran (freq=%s)", name, freq) - return None + return (False, None) with sem.lock(name, freq, clear_on_fail) as lk: if not lk: raise LockFailure("Failed to acquire lock for %s" % name) @@ -158,9 +158,10 @@ class Runners(object): LOG.debug("Running %s with args %s using lock %s", functor, args, lk) if isinstance(args, (dict)): - return functor(**args) + results = functor(**args) else: - return functor(*args) + results = functor(*args) + return (True, results) class ContentHandlers(object): |