From 50ec3b78686ae812c44b22835bf1203c92f5e5e3 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Tue, 19 Jun 2012 11:04:42 -0700 Subject: 1. When running, return the function results as well as a boolean that stated if it ran. --- cloudinit/helpers.py | 7 ++++--- 1 file 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): -- cgit v1.2.3