Commit 68d0fc8b authored by Darko Poljak's avatar Darko Poljak

Clarify stdin input

Resolve #836.
parent 2885c6a2
Pipeline #2276 passed with stage
in 1 minute and 9 seconds
......@@ -273,8 +273,7 @@ def get_parsers():
'-f', '--file',
help=('Read specified file for a list of additional hosts to '
'operate on or if \'-\' is given, read stdin (one host per '
'line). If no host or host file is specified then, by '
'default, read hosts from stdin.'),
'line).'),
dest='hostfile', required=False)
parser['config_args'].add_argument(
'-p', '--parallel', nargs='?', metavar='HOST_MAX',
......
......@@ -177,7 +177,10 @@ class Config:
# if no host source is specified then read hosts from stdin
if not (args.hostfile or args.host):
args.hostfile = '-'
if args.tag or args.all_tagged_hosts:
raise cdist.Error(("Target host tag(s) missing"))
else:
raise cdist.Error(("Target host(s) missing"))
if args.manifest == '-':
# read initial manifest from stdin
......@@ -251,6 +254,11 @@ class Config:
log.trace("Processing hosts in parallel")
else:
log.trace("Processing hosts sequentially")
if args.hostfile == '-' and sys.stdin.isatty():
if args.tag or args.all_tagged_hosts:
log.debug("Waiting tag(s) from stdin")
else:
log.debug("Waiting host(s) from stdin")
for entry in it:
if isinstance(entry, tuple):
# if configuring by specified tags
......
......@@ -177,10 +177,8 @@ Install command is currently in beta.
**-f HOSTFILE, --file HOSTFILE**
Read specified file for a list of additional hosts to operate on
or if '-' is given, read stdin (one host per line).
If no host or host file is specified then, by default,
read hosts from stdin. For the file format see
:strong:`HOSTFILE FORMAT` below.
or if '-' is given, read stdin (one host per line). For the file
format see :strong:`HOSTFILE FORMAT` below.
**-g CONFIG_FILE, --config-file CONFIG_FILE**
Use specified custom configuration file.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment