allow zero hosts to be specified, fixup exit_error

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-09-08 22:44:25 +02:00
parent ab0cd9430f
commit 7e8362eeed

View file

@ -160,7 +160,7 @@ class Cdist:
try:
subprocess.check_call(*args, **kargs)
except subprocess.CalledProcessError:
self.exit_error("Command failed:", " ".join(*args))
self.exit_error("Command failed: " + " ".join(*args))
def remote_run_or_fail(self, *args, **kargs):
"""Run something on the remote side and fail is something breaks"""
@ -349,20 +349,20 @@ class Cdist:
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='cdist ' + VERSION)
parser.add_argument('host', nargs='+', help='one or more hosts to operate on')
parser.add_argument('host', nargs='*', help='one or more hosts to operate on')
parser.add_argument('-b', '--banner',
help='Show cdist banner',
action='store_true', dest='banner')
parser.add_argument('-d', '--debug', help='set log level to debug',
parser.add_argument('-d', '--debug', help='Set log level to debug',
action='store_true')
parser.add_argument('-i', '--initial-manifest',
help='path to a cdist manifest or - to read from stdin',
help='Path to a cdist manifest or - to read from stdin',
dest='manifest', required=False)
parser.add_argument('-p', '--parallel',
help='operate on multiple hosts in parallel',
help='Operate on multiple hosts in parallel',
action='store_true', dest='parallel')
parser.add_argument('-s', '--sequential',
help='operate on multiple hosts sequentially',
help='Operate on multiple hosts sequentially',
action='store_false', dest='parallel')
args = parser.parse_args(sys.argv[1:])