prepare installation routine

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-09-16 13:13:56 +02:00
parent 3f2a27fa82
commit 7c56630924

View file

@ -604,6 +604,10 @@ def banner(args):
print(BANNER) print(BANNER)
sys.exit(0) sys.exit(0)
def install(args):
"""Install remote system"""
process = {}
def config(args): def config(args):
"""Configure remote system""" """Configure remote system"""
process = {} process = {}
@ -648,25 +652,33 @@ if __name__ == "__main__":
add_help=False) add_help=False)
parser['banner'].set_defaults(func=banner) parser['banner'].set_defaults(func=banner)
# Config # Config and install (common stuff)
parser['config'] = parser['sub'].add_parser('config', parser['configinstall'] = argparse.ArgumentParser(add_help=False)
parents=[parser['most']]) parser['configinstall'].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['configinstall'].add_argument('-c', '--cdist-home',
help='Change cdist home (default: .. from bin directory)', help='Change cdist home (default: .. from bin directory)',
action='store') action='store')
parser['config'].add_argument('-i', '--initial-manifest', parser['configinstall'].add_argument('-i', '--initial-manifest',
help='Path to a cdist manifest', help='Path to a cdist manifest',
dest='manifest', required=False) dest='manifest', required=False)
parser['config'].add_argument('-p', '--parallel', parser['configinstall'].add_argument('-p', '--parallel',
help='Operate on multiple hosts in parallel', help='Operate on multiple hosts in parallel',
action='store_true', dest='parallel') action='store_true', dest='parallel')
parser['config'].add_argument('-s', '--sequential', parser['configinstall'].add_argument('-s', '--sequential',
help='Operate on multiple hosts sequentially (default)', help='Operate on multiple hosts sequentially (default)',
action='store_false', dest='parallel') action='store_false', dest='parallel')
# Config
parser['config'] = parser['sub'].add_parser('config',
parents=[parser['most'], parser['configinstall']])
parser['config'].set_defaults(func=config) parser['config'].set_defaults(func=config)
# Install
parser['install'] = parser['sub'].add_parser('install',
parents=[parser['most'], parser['configinstall']])
parser['install'].set_defaults(func=install)
for p in parser: for p in parser:
parser[p].epilog = "Get cdist at http://www.nico.schottelius.org/software/cdist/" parser[p].epilog = "Get cdist at http://www.nico.schottelius.org/software/cdist/"