scripts/func-command | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) New commits: commit 2ce8714deb30ad8a6bb0674d86a364ba581cf491 Merge: 0b13b1e... 76b6d0f... Author: Seth Vidal <skvidal@xxxxxxxxxxxxxxxxx> Date: Tue Nov 9 16:32:17 2010 -0500 Merge branch 'master' of ssh://git.fedorahosted.org/git/func * 'master' of ssh://git.fedorahosted.org/git/func: Exclude down hosts otherwise func "*" ping command causes following error; commit 0b13b1ebc341854e5e7ddc3719c38dc1ecb2ce97 Author: Seth Vidal <skvidal@xxxxxxxxxxxxxxxxx> Date: Tue Nov 9 16:28:24 2010 -0500 add --onetime and --returncodes options to func-command diff --git a/scripts/func-command b/scripts/func-command index 5e0f43d..32f9b46 100755 --- a/scripts/func-command +++ b/scripts/func-command @@ -11,6 +11,8 @@ from func.utils import is_error 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 = handle_base_func_options(parser, opts) @@ -37,13 +39,17 @@ def main(args): errorprint(msg) continue - # FIXME - maybe for commands don't do it one line with hostname first + if opts.oneline: + if opts.returncodes: + print '%s:%s:%s' % (hn, output[0], output[1]) + else: + print '%s:%s' % (hn, output[1]) + else: + if opts.returncodes: + print '%s:\nreturn code:%s\n%s' % (hn, output[0], output[1]) + else: + print '%s:\n%s' % (hn, output[1]) - print '%s' % hn - print output[1] - print '' - - return 0 if __name__ == "__main__": sys.exit(main(sys.argv[1:])) _______________________________________________ Func-list mailing list Func-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/func-list