diff options
author | Adrian Likins <alikins@redhat.com> | 2008-10-31 12:39:38 -0400 |
---|---|---|
committer | Adrian Likins <alikins@redhat.com> | 2008-10-31 12:39:38 -0400 |
commit | c46ca62627d3a6ccd431f58bdb9d4f76694db9f9 (patch) | |
tree | e42030b88e205659eb001fc51e2634e3ee8b6b10 /func/overlord/client.py | |
parent | 9053dfe432185a4a4649fba4e90686a024720db4 (diff) | |
download | func-c46ca62627d3a6ccd431f58bdb9d4f76694db9f9.tar.gz func-c46ca62627d3a6ccd431f58bdb9d4f76694db9f9.tar.xz func-c46ca62627d3a6ccd431f58bdb9d4f76694db9f9.zip |
Fix a bug with "func-transmit --yaml" send bools as strings and causing
weird things to happen to async.
Add a "smart_bool" method to client.py that will take the string and/or
bool it gets and make a bool of it.
test_func_transmit.py: add option to specify async/nfork params for
the non async test calls for testing
add a couple test cases that call methods with "async=True, nforks=1"
to make sure they do the right thing
Diffstat (limited to 'func/overlord/client.py')
-rwxr-xr-x | func/overlord/client.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/func/overlord/client.py b/func/overlord/client.py index 12b4c61..b0ca7df 100755 --- a/func/overlord/client.py +++ b/func/overlord/client.py @@ -154,6 +154,16 @@ def is_minion(minion_string): return minions.is_minion() + +# from a comment at http://codecomments.wordpress.com/2008/04/08/converting-a-string-to-a-boolean-value-in-python/ +# basically excepy a string or a bool for the async arg, since func-transmit can be a bit weird about it especially +# if we are using an older version of yaml (and we are...) +def smart_bool(s): + if s is True or s is False: + return s + s = str(s).strip().lower() + return not s in ['false','f','n','0',''] + class Overlord(object): def __init__(self, server_spec, port=DEFAULT_PORT, interactive=False, @@ -178,10 +188,12 @@ class Overlord(object): self.interactive = interactive self.noglobs = noglobs self.nforks = nforks - self.async = async + self.async = smart_bool(async) + #self.async = async self.delegate = delegate self.mapfile = mapfile + self.minions_class = Minions(self.server_spec, port=self.port, noglobs=self.noglobs,verbose=self.verbose) self.minions = self.minions_class.get_urls() if len(self.minions) == 0: @@ -377,6 +389,7 @@ class Overlord(object): minionurls = [] use_delegate = False delegation_path = [] + def process_server(bucketnumber, buckets, server): |