cleanups
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
parent
4d065443da
commit
581562aae9
2 changed files with 9 additions and 23 deletions
18
bin/cdist
18
bin/cdist
|
@ -428,14 +428,12 @@ class Cdist:
|
||||||
output_fd.close()
|
output_fd.close()
|
||||||
|
|
||||||
def init_deploy(self):
|
def init_deploy(self):
|
||||||
|
"""Ensure the base directories are cleaned up"""
|
||||||
log.debug("Creating clean directory structure")
|
log.debug("Creating clean directory structure")
|
||||||
|
|
||||||
self.remove_remote_dir(REMOTE_BASE_DIR)
|
self.remove_remote_dir(REMOTE_BASE_DIR)
|
||||||
self.remote_mkdir(REMOTE_BASE_DIR)
|
self.remote_mkdir(REMOTE_BASE_DIR)
|
||||||
|
|
||||||
# # Link configuraion source directory - consistent with remote
|
|
||||||
# run_or_fail(["ln -sf", "$__cdist_conf_dir", "$__cdist_local_base_dir/$__cdist_name_conf_dir"])
|
|
||||||
|
|
||||||
def run_initial_manifest(self):
|
def run_initial_manifest(self):
|
||||||
"""Run the initial manifest"""
|
"""Run the initial manifest"""
|
||||||
env = { "__manifest" : self.manifest_dir }
|
env = { "__manifest" : self.manifest_dir }
|
||||||
|
@ -605,7 +603,6 @@ def banner(args):
|
||||||
|
|
||||||
def config(args):
|
def config(args):
|
||||||
"""Configure remote system"""
|
"""Configure remote system"""
|
||||||
print(args)
|
|
||||||
process = {}
|
process = {}
|
||||||
|
|
||||||
if len(args.host) == 0:
|
if len(args.host) == 0:
|
||||||
|
@ -633,7 +630,6 @@ def config(args):
|
||||||
log.info("Total processing time for %s host(s): %s", len(args.host),
|
log.info("Total processing time for %s host(s): %s", len(args.host),
|
||||||
(time_end - time_start).total_seconds())
|
(time_end - time_start).total_seconds())
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# Construct parser others can reuse
|
# Construct parser others can reuse
|
||||||
parser = {}
|
parser = {}
|
||||||
|
@ -641,14 +637,10 @@ if __name__ == "__main__":
|
||||||
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/")
|
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')
|
|
||||||
parser['most'].add_argument('-V', '--version',
|
parser['most'].add_argument('-V', '--version',
|
||||||
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,
|
||||||
|
@ -666,7 +658,7 @@ if __name__ == "__main__":
|
||||||
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['config'].add_argument('-i', '--initial-manifest',
|
||||||
help='Path to a cdist manifest or - to read from stdin',
|
help='Path to a cdist manifest',
|
||||||
dest='manifest', required=False)
|
dest='manifest', required=False)
|
||||||
parser['config'].add_argument('-p', '--parallel',
|
parser['config'].add_argument('-p', '--parallel',
|
||||||
help='Operate on multiple hosts in parallel',
|
help='Operate on multiple hosts in parallel',
|
||||||
|
@ -678,7 +670,7 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
args = parser['main'].parse_args(sys.argv[1:])
|
args = parser['main'].parse_args(sys.argv[1:])
|
||||||
|
|
||||||
# Most subcommands to have --debug, so handle it here
|
# Most subcommands have --debug, so handle it here
|
||||||
if 'debug' in args:
|
if 'debug' in args:
|
||||||
if args.debug:
|
if args.debug:
|
||||||
logging.root.setLevel(logging.DEBUG)
|
logging.root.setLevel(logging.DEBUG)
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
For 2.0.0:
|
|
||||||
|
|
||||||
- support subcommands!
|
|
||||||
config (deploy)
|
|
||||||
install (provision)
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
- Support parallel execution
|
- Support parallel execution
|
||||||
- and maximum number of parallel runs (-p X)
|
- and maximum number of parallel runs (-p X)
|
||||||
- error handling / report failed hosts
|
- error handling / report failed hosts
|
||||||
|
@ -19,3 +11,5 @@ For 2.0.0:
|
||||||
- Remove man1/cdist-type-emulator.text
|
- Remove man1/cdist-type-emulator.text
|
||||||
|
|
||||||
- Replace bin/cdist-type-template
|
- Replace bin/cdist-type-template
|
||||||
|
|
||||||
|
- Allow manifest to be read from stdin
|
||||||
|
|
Loading…
Reference in a new issue