fixup most arguments for config

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-09-13 17:59:11 +02:00
parent df7f27f94b
commit 8d1b4236d4

View file

@ -598,15 +598,16 @@ class Cdist:
self.deploy_to() self.deploy_to()
self.cleanup() self.cleanup()
def banner(*args): def banner(args):
"""Guess what :-)""" """Guess what :-)"""
print(BANNER) print(BANNER)
sys.exit(0) sys.exit(0)
def config(*args): def config(args):
"""Configure remote system""" """Configure remote system"""
print(*args) print(args)
process = {} process = {}
if len(args.host) == 0: if len(args.host) == 0:
parser.print_help() parser.print_help()
sys.exit(1) sys.exit(1)
@ -637,7 +638,8 @@ if __name__ == "__main__":
# Construct parser others can reuse # Construct parser others can reuse
parser = {} parser = {}
# Options _all_ parsers have in common # Options _all_ parsers have in common
parser['most'] = argparse.ArgumentParser(add_help=False) parser['most'] = argparse.ArgumentParser(add_help=False,
epilog="Get cdist at http://www.nico.schottelius.org/software/cdist/")
parser['most'].add_argument('-d', '--debug', parser['most'].add_argument('-d', '--debug',
help='Set log level to debug', help='Set log level to debug',
action='store_true') action='store_true')
@ -645,9 +647,12 @@ if __name__ == "__main__":
help='Show version', help='Show version',
action='version', action='version',
version='%(prog)s ' + VERSION) version='%(prog)s ' + VERSION)
#version='%(prog)s ' + VERSION)
# Main subcommand parser # Main subcommand parser
parser['main'] = argparse.ArgumentParser(description='cdist ' + VERSION) parser['main'] = argparse.ArgumentParser(description='cdist ' + VERSION,
parents=[parser['most']])
parser['sub'] = parser['main'].add_subparsers() parser['sub'] = parser['main'].add_subparsers()
parser['banner'] = parser['sub'].add_parser('banner') parser['banner'] = parser['sub'].add_parser('banner')
@ -656,7 +661,7 @@ if __name__ == "__main__":
parser['config'] = parser['sub'].add_parser('config', parser['config'] = parser['sub'].add_parser('config',
aliases=['deploy'], aliases=['deploy'],
parents=[parser['most']]) parents=[parser['most']])
parser['config'].add_argument('host', nargs='*', parser['config'].add_argument('host', nargs='+',
help='one or more hosts to operate on') help='one or more hosts to operate on')
parser['config'].add_argument('-c', '--cdist-home', parser['config'].add_argument('-c', '--cdist-home',
help='Change cdist home (default: .. from bin directory)', help='Change cdist home (default: .. from bin directory)',