From a1ba474f36ba7391accb63f3282138fcd2d480ce Mon Sep 17 00:00:00 2001 From: "Krzysztof A. Adamski" Date: Thu, 7 Aug 2008 19:28:33 -0400 Subject: Use overlod module to list_minions() instead of the hack in func-transmit. --- scripts/func-transmit | 50 +++++++++++++++++++------------------------------- 1 file changed, 19 insertions(+), 31 deletions(-) (limited to 'scripts') diff --git a/scripts/func-transmit b/scripts/func-transmit index 4fe3cc3..40ccae6 100644 --- a/scripts/func-transmit +++ b/scripts/func-transmit @@ -93,38 +93,26 @@ def main(argv): method = params.get('method','unknown') async = params.get('async', False) - if method == "list_minions": - # clients will default to * if not specified, and specifing is a good - # way to see who is in what group, etc, so pass it though - - if async == True: - raise NoAsyncForListMinionException("list_minions method can not be run in async") - - minion_set = fc.Minions(clients) - servers = minion_set.get_all_hosts() - results = servers - + # scan more arguments + nforks = params.get('nforks', 1) + module = params.get('module', None) + parameters = params.get('parameters', None) + + # make the call + client = fc.Overlord(clients, async=async, nforks=nforks) + if module is None: + method_handle = getattr(client, method) + else: + module_handle = getattr(client, module) + method_handle = getattr(module_handle, method) + + if parameters is not None: + # listify if we get something thats not a list + if not is_a_list(parameters): + parameters = [parameters] + results = method_handle(*parameters) else: - # scan more arguments - nforks = params.get('nforks', 1) - module = params.get('module', None) - parameters = params.get('parameters', None) - - # make the call - client = fc.Overlord(clients, async=async, nforks=nforks) - if module is None: - method_handle = getattr(client, method) - else: - module_handle = getattr(client, module) - method_handle = getattr(module_handle, method) - - if parameters is not None: - # listify if we get something thats not a list - if not is_a_list(parameters): - parameters = [parameters] - results = method_handle(*parameters) - else: - results = method_handle() + results = method_handle() # convert to selected language (default is JSON) if (options.json): -- cgit