Fail if the Overcloud inventory is empty

If tripleo-ansible-inventory can not retrieve the
inventory, the script should fail and
display an error message for the users to
fix the plan or stack name before continuing.

Change-Id: I76fe01b7f2ec84db8a8aeaa749cb7b961667b3c9
Closes-Bug: 1768011
This commit is contained in:
Carlos Camacho 2018-04-30 14:12:04 +02:00
parent 9f7b287a6a
commit 773bef1c7a
1 changed files with 7 additions and 0 deletions

View File

@ -138,6 +138,13 @@ def main():
ansible_ssh_user=configs.ansible_ssh_user,
plan_name=configs.stack or configs.plan)
if inventory.get_overcloud_environment() == {}:
print("Error, the environment data can not "
"be empty '{}', please check that the --stack "
"or the --plan options are configured correctly "
"and if they correspond to the stack name.")
sys.exit(1)
if configs.list:
try:
inventory_list = inventory.list()