From 773bef1c7a5e7015c4df42ce23e2f9c8c158f424 Mon Sep 17 00:00:00 2001 From: Carlos Camacho Date: Mon, 30 Apr 2018 14:12:04 +0200 Subject: [PATCH] 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 --- scripts/tripleo-ansible-inventory | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/tripleo-ansible-inventory b/scripts/tripleo-ansible-inventory index 0df3c9383..833e6dd9c 100755 --- a/scripts/tripleo-ansible-inventory +++ b/scripts/tripleo-ansible-inventory @@ -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()