Merge "More detail in arg validation" into stable/train
This commit is contained in:
commit
7bb61c00c7
|
@ -88,6 +88,13 @@ def _parse_config():
|
||||||
'variable missing or --os-cloud option is not set, '
|
'variable missing or --os-cloud option is not set, '
|
||||||
'unable to proceed.', file=sys.stderr)
|
'unable to proceed.', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
if (configs.static_yaml_inventory or configs.list) and configs.host:
|
||||||
|
print(
|
||||||
|
"ERROR: can't list (--list) all hosts or generate an inventory "
|
||||||
|
"(--static-yaml-inventory) while looking for a specific host "
|
||||||
|
"(--host)"
|
||||||
|
)
|
||||||
|
sys.exit(1)
|
||||||
if configs.auth_url:
|
if configs.auth_url:
|
||||||
if '/v2.0' in configs.auth_url:
|
if '/v2.0' in configs.auth_url:
|
||||||
configs.auth_url = configs.auth_url.replace('/v2.0', '/v3')
|
configs.auth_url = configs.auth_url.replace('/v2.0', '/v3')
|
||||||
|
@ -216,7 +223,9 @@ def main():
|
||||||
if configs.debug:
|
if configs.debug:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
elif configs.static_yaml_inventory:
|
elif configs.host:
|
||||||
|
print(json.dumps(inventory.host()))
|
||||||
|
if configs.static_yaml_inventory:
|
||||||
try:
|
try:
|
||||||
inventory.write_static_inventory(configs.static_yaml_inventory)
|
inventory.write_static_inventory(configs.static_yaml_inventory)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -225,8 +234,6 @@ def main():
|
||||||
if configs.debug:
|
if configs.debug:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
elif configs.host:
|
|
||||||
print(json.dumps(inventory.host()))
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue