From 9bace992f33e4935470e80470712e98c3c994634 Mon Sep 17 00:00:00 2001 From: Jose Luis Franco Arza Date: Fri, 18 May 2018 12:04:26 +0200 Subject: [PATCH] Add std_error output to error log in tripleo-ansible-inventory. The standard output was missing in one of the error logs inside tripleo-ansible-inventory. This made it pretty hard to debug when ansible-playbook failed due that inventory script error. This patch also formats a little the error message to give some more info about the issue. Related-Bug: #1768011 Change-Id: Ib240a4626bedb4d2a2d0b51caf696b3728fb7fb0 --- scripts/tripleo-ansible-inventory | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/tripleo-ansible-inventory b/scripts/tripleo-ansible-inventory index 833e6dd9c..7e53cc4a6 100755 --- a/scripts/tripleo-ansible-inventory +++ b/scripts/tripleo-ansible-inventory @@ -139,10 +139,11 @@ def main(): 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.") + print("ERROR: The environment data can not " + "be empty '{{}}', please check that the --stack " + "or --plan options are configured correctly " + "and the stack {} exists".format(configs.stack or configs.plan) + ,file=sys.stderr) sys.exit(1) if configs.list: @@ -150,7 +151,7 @@ def main(): inventory_list = inventory.list() print(json.dumps(inventory_list)) except Exception as e: - print("Error creating inventory: {}".format(e), + print("ERROR: Error creating inventory: {}".format(e), file=sys.stderr) if configs.debug: traceback.print_exc()