func/overlord/scripts.py | 2 +- scripts/func-command | 2 +- scripts/func-down-hosts | 2 +- scripts/func-yum | 12 ++++++++++++ 4 files changed, 15 insertions(+), 3 deletions(-) New commits: commit 713ada86a5e7eb97bd193de9c7baafea72e6b808 Author: Seth Vidal <skvidal@xxxxxxxxxxxxxxxxx> Date: Mon Dec 6 14:46:29 2010 -0500 add a confirm-on-change method to func-yum and list out what hosts we're going to run against AND what we intend to do before doing it. It's mostly a safety valve to keep me from fat-fingering the host list :( diff --git a/scripts/func-yum b/scripts/func-yum index e05a7ce..e2374bb 100755 --- a/scripts/func-yum +++ b/scripts/func-yum @@ -223,6 +223,15 @@ def _wait_for_async(fc, opts, jobid): return results +def _confirm_on_change(basecmd, extcmds, hosts): + print 'Preparing to run: %s %s' % (basecmd, ' '.join(extcmds)) + print 'Running on:\n %s' % '\n '.join(sorted(hosts)) + try: + junk = raw_input('If not okay, ctrl-c now, else press enter now') + except KeyboardInterrupt, e: + print "\n\nExiting" + sys.exit(0) + def store_info(fc, opts): # retrieve info to outputpath/$hostname/installed/timestamp @@ -491,6 +500,8 @@ def main(args): hosts, offline = filter_hosts(hosts, opts) fc = fclient.Client(';'.join(hosts), timeout=opts.timeout, nforks=opts.forks, async=True) + _confirm_on_change(basecmd, extcmds, hosts) + errors = update(fc, opts, extcmds) for error in errors: errorprint(' %s' % error) @@ -578,6 +589,7 @@ def main(args): elif basecmd == 'custom': hosts, offline = filter_hosts(hosts, opts) fc = fclient.Client(';'.join(hosts), timeout=opts.timeout, nforks=opts.forks) + _confirm_on_change(basecmd, extcmds, hosts) errors = custom(fc, opts, extcmds) for error in errors: errorprint(' %s' % error) commit a50b108a1b074c5a83412f6f92b9b0a7568f549f Author: Todd Zullinger <tmz@xxxxxxxxx> Date: Mon Dec 6 14:35:06 2010 -0500 typo/thinko fix diff --git a/scripts/func-command b/scripts/func-command index 32f9b46..4d1d522 100755 --- a/scripts/func-command +++ b/scripts/func-command @@ -13,7 +13,7 @@ def main(args): parser = base_func_parser(outputpath=False) parser.add_option('--returncodes', action='store_true', help="prefix each line with the commands returncode") parser.add_option('--oneline', action='store_true', help="output all things as one line - to make grepping easier, will not remove \n's from output of commands, though") - opts, args, parser = parse_args(args) + opts, args = parser.parse_args(args) opts = handle_base_func_options(parser, opts) if len(args) < 1: diff --git a/scripts/func-down-hosts b/scripts/func-down-hosts index 8ee08a9..3f6b60a 100755 --- a/scripts/func-down-hosts +++ b/scripts/func-down-hosts @@ -10,7 +10,7 @@ from func.utils import is_error def main(args): parser = base_func_parser(outputpath=False, timeoutdef=10) - opts, args, parser = parse_args(args) + opts, args = parser.parse_args(args) opts = handle_base_func_options(parser, opts) commit 3508bfa40e33432ffaee127743a95b0d106cec0d Author: Todd Zullinger <tmz@xxxxxxxxx> Date: Mon Dec 6 14:32:49 2010 -0500 typo fix diff --git a/func/overlord/scripts.py b/func/overlord/scripts.py index 4c84dd2..4846094 100644 --- a/func/overlord/scripts.py +++ b/func/overlord/scripts.py @@ -44,5 +44,5 @@ def handle_base_func_options(parser, opts): return opts -def errorprint(msg) +def errorprint(msg): print >> sys.stderr, msg _______________________________________________ Func-list mailing list Func-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/func-list