summaryrefslogtreecommitdiffstats
path: root/utils/src/ooinstall
diff options
context:
space:
mode:
authorBrenton Leanhardt <bleanhar@redhat.com>2015-12-08 15:21:19 -0500
committerBrenton Leanhardt <bleanhar@redhat.com>2015-12-08 15:21:19 -0500
commit04bac49fc673a89b74b20842a90b781abca8d683 (patch)
treeb3e3ad01b0e6568429b35a369fbc9cc1f00139b2 /utils/src/ooinstall
parenta3e601b2abd4e64d983bf7bfd70637b7f06b10d2 (diff)
parentb69a8724b38583a808f99c73cfed2d635353bf4c (diff)
downloadopenshift-04bac49fc673a89b74b20842a90b781abca8d683.tar.gz
openshift-04bac49fc673a89b74b20842a90b781abca8d683.tar.bz2
openshift-04bac49fc673a89b74b20842a90b781abca8d683.tar.xz
openshift-04bac49fc673a89b74b20842a90b781abca8d683.zip
Merge pull request #1038 from smunilla/big_stack_trace
atomic-openshift-installer: Error handling on yaml loading
Diffstat (limited to 'utils/src/ooinstall')
-rw-r--r--utils/src/ooinstall/openshift_ansible.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/utils/src/ooinstall/openshift_ansible.py b/utils/src/ooinstall/openshift_ansible.py
index 17196a813..fd2cd7fbd 100644
--- a/utils/src/ooinstall/openshift_ansible.py
+++ b/utils/src/ooinstall/openshift_ansible.py
@@ -157,9 +157,15 @@ def load_system_facts(inventory_file, os_facts_path, env_vars, verbose=False):
status = subprocess.call(args, env=env_vars, stdout=FNULL)
if not status == 0:
return [], 1
- callback_facts_file = open(CFG.settings['ansible_callback_facts_yaml'], 'r')
- callback_facts = yaml.load(callback_facts_file)
- callback_facts_file.close()
+
+ with open(CFG.settings['ansible_callback_facts_yaml'], 'r') as callback_facts_file:
+ try:
+ callback_facts = yaml.safe_load(callback_facts_file)
+ except yaml.YAMLError, exc:
+ print "Error in {}".format(CFG.settings['ansible_callback_facts_yaml']), exc
+ print "Try deleting and rerunning the atomic-openshift-installer"
+ sys.exit(1)
+
return callback_facts, 0