From 581562aae96890c027fe367478ea429ff0b122d9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 18:05:15 +0200 Subject: [PATCH] cleanups Signed-off-by: Nico Schottelius --- bin/cdist | 22 +++++++--------------- doc/dev/todo/niconext | 10 ++-------- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/bin/cdist b/bin/cdist index 7e3e9a1c..42838093 100755 --- a/bin/cdist +++ b/bin/cdist @@ -428,14 +428,12 @@ class Cdist: output_fd.close() def init_deploy(self): + """Ensure the base directories are cleaned up""" log.debug("Creating clean directory structure") self.remove_remote_dir(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): """Run the initial manifest""" env = { "__manifest" : self.manifest_dir } @@ -605,7 +603,6 @@ def banner(args): def config(args): """Configure remote system""" - print(args) process = {} 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), (time_end - time_start).total_seconds()) - if __name__ == "__main__": # Construct parser others can reuse parser = {} @@ -641,14 +637,10 @@ if __name__ == "__main__": parser['most'] = argparse.ArgumentParser(add_help=False, epilog="Get cdist at http://www.nico.schottelius.org/software/cdist/") parser['most'].add_argument('-d', '--debug', - help='Set log level to debug', - action='store_true') + help='Set log level to debug', action='store_true') parser['most'].add_argument('-V', '--version', - help='Show version', - action='version', - version='%(prog)s ' + VERSION) - #version='%(prog)s ' + VERSION) - + help='Show version', action='version', + version='%(prog)s ' + VERSION) # Main subcommand parser parser['main'] = argparse.ArgumentParser(description='cdist ' + VERSION, @@ -659,14 +651,14 @@ if __name__ == "__main__": parser['banner'].set_defaults(func=banner) parser['config'] = parser['sub'].add_parser('config', - parents=[parser['most']]) + parents=[parser['most']]) parser['config'].add_argument('host', nargs='+', help='one or more hosts to operate on') parser['config'].add_argument('-c', '--cdist-home', help='Change cdist home (default: .. from bin directory)', action='store') 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) parser['config'].add_argument('-p', '--parallel', help='Operate on multiple hosts in parallel', @@ -678,7 +670,7 @@ if __name__ == "__main__": 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 args.debug: logging.root.setLevel(logging.DEBUG) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 6b87b8fe..63f9b629 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,11 +1,3 @@ -For 2.0.0: - - - support subcommands! - config (deploy) - install (provision) - --------------------------------------------------------------------------------- - - Support parallel execution - and maximum number of parallel runs (-p X) - error handling / report failed hosts @@ -19,3 +11,5 @@ For 2.0.0: - Remove man1/cdist-type-emulator.text - Replace bin/cdist-type-template + +- Allow manifest to be read from stdin