func/jobthing.py | 6 ++++-- func/overlord/client.py | 8 +++++--- func/overlord/cmd_modules/call.py | 8 +------- scripts/func | 6 +++++- 4 files changed, 15 insertions(+), 13 deletions(-) New commits: commit bae95d83c21a625913be94762e87325debd00f83 Author: Seth Vidal <skvidal@xxxxxxxxxxxxxxxxx> Date: Thu Aug 26 21:12:32 2010 -0400 the basic outputter was making a lot of assumptions of 'command.run' and wouldn't work reliably at all with any other call. So I neutered it - it shouldn't be used anyway diff --git a/func/overlord/cmd_modules/call.py b/func/overlord/cmd_modules/call.py index d6fd743..a351219 100644 --- a/func/overlord/cmd_modules/call.py +++ b/func/overlord/cmd_modules/call.py @@ -251,13 +251,7 @@ class Call(base_command.BaseCommand): return pickle.dumps(data) if self.options.basic: - output = "" - (minion,results) = data - output += '**** Results for %s (return value: %d) ****\n' % (minion, results[0]) - output += results[1] - if results[2].strip() not in (None, ''): - output += '**** Output to STDERR ****\n' - output += results[2] + output = str(data) return output return pprint.pformat(data) commit c6b17a1d104468e468931a624ef2915aaa6e4b4f Author: Seth Vidal <skvidal@xxxxxxxxxxxxxxxxx> Date: Thu Aug 26 21:08:32 2010 -0400 when we setup any kind of instance of the overlord object make sure we pass in all the proper setups - config, timeouts, etc. doing this keeps async calls from having the default timeout for the config instead of whatever timeout is passed in from the func script commandline diff --git a/func/jobthing.py b/func/jobthing.py index 69899a5..59e494c 100644 --- a/func/jobthing.py +++ b/func/jobthing.py @@ -243,12 +243,14 @@ def minion_async_run(retriever, method, args,minion_query=None): from func.index_db import write_index_data from func.index_db import key_exists -def job_status(jobid, client_class=None): +def job_status(jobid, client_class=None, client_class_config=None): # NOTE: client_class is here to get around some evil circular reference # type stuff. This is intended to be called by minions (who can leave it None) # or by the Client module code (which does not need to be worried about it). API # users should not be calling jobthing.py methods directly. + # NOTE: class_config is here so we can pass in all of our settings from the + # parent - otherwise async jobs with timeouts go straight to hell. got_status = __get_status(jobid) # if the status comes back as JOB_ID_PARTIAL what we have is actually a hash @@ -281,7 +283,7 @@ def job_status(jobid, client_class=None): match_dict={jobid:[]} match_dict[jobid].append((minion_job,host)) - client = client_class(host, noglobs=True, async=False) + client = client_class(host, noglobs=True, async=False, config=client_class_config) minion_result = client.jobs.job_status(minion_job) if type(minion_result) != list or len(minion_result)!=2: diff --git a/func/overlord/client.py b/func/overlord/client.py index 47a6c64..46b6c97 100644 --- a/func/overlord/client.py +++ b/func/overlord/client.py @@ -578,7 +578,8 @@ class Overlord(object): """ Use this to acquire status from jobs when using run with async client handles """ - status,async_result = jobthing.job_status(jobid, client_class=Overlord) + status,async_result = jobthing.job_status(jobid, client_class=Overlord, + client_class_config=self.config) if not self.overlord_query.fact_query: #that will use the default overlord job_status return (status,display_active_facts(async_result)) @@ -1063,9 +1064,10 @@ class Overlord(object): nforks = copy(self.nforks), async = copy(self.async), delegate=copy(self.delegate), - mapfile = copy(self.mapfile) + mapfile = copy(self.mapfile), + config = copy(self.config) ) - + c.timeout = copy(self.timeout) c.cm_config = copy(self.cm_config) return c commit 791fb3ada34b644fe681252ca816b3c6567728e5 Author: Seth Vidal <skvidal@xxxxxxxxxxxxxxxxx> Date: Thu Aug 26 20:45:56 2010 -0400 the ret can be a string and not a value - so if it is a string - interpret it as success diff --git a/scripts/func b/scripts/func index 7607ea8..2a1bbe7 100755 --- a/scripts/func +++ b/scripts/func @@ -25,7 +25,11 @@ import func.overlord.func_command as func_command myname, argv = sys.argv[0], sys.argv[1:] cli = func_command.FuncCommandLine() try: - sys.exit(cli.parse(argv)) + ret = cli.parse(argv) + if type(ret) == type(1): + sys.exit(ret) + else: + sys.exit(0) except Func_Client_Exception, e: print "ERROR:", e sys.exit(1) _______________________________________________ Func-list mailing list Func-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/func-list