allow zero hosts to be specified, fixup exit_error

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
remotes/origin/feature_files_export
Nico Schottelius 13 years ago
parent ab0cd9430f
commit 7e8362eeed
  1. 12
      bin/cdist

@ -160,7 +160,7 @@ class Cdist:
try: try:
subprocess.check_call(*args, **kargs) subprocess.check_call(*args, **kargs)
except subprocess.CalledProcessError: 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): def remote_run_or_fail(self, *args, **kargs):
"""Run something on the remote side and fail is something breaks""" """Run something on the remote side and fail is something breaks"""
@ -349,20 +349,20 @@ class Cdist:
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser(description='cdist ' + VERSION) 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', parser.add_argument('-b', '--banner',
help='Show cdist banner', help='Show cdist banner',
action='store_true', dest='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') action='store_true')
parser.add_argument('-i', '--initial-manifest', 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) dest='manifest', required=False)
parser.add_argument('-p', '--parallel', parser.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.add_argument('-s', '--sequential', parser.add_argument('-s', '--sequential',
help='operate on multiple hosts sequentially', help='Operate on multiple hosts sequentially',
action='store_false', dest='parallel') action='store_false', dest='parallel')
args = parser.parse_args(sys.argv[1:]) args = parser.parse_args(sys.argv[1:])

Loading…
Cancel
Save