summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorEric Wolinetz <ewolinet@redhat.com>2018-02-08 15:28:11 -0600
committerEric Wolinetz <ewolinet@redhat.com>2018-02-08 15:28:11 -0600
commit74730c426025286766971113dd40cc6bf3719267 (patch)
treee87de23685443e409236c86c0f3fb2fb8e963cf0 /roles
parent1ab6b4201af2474106d68265515de8d0c63b285d (diff)
downloadopenshift-74730c426025286766971113dd40cc6bf3719267.tar.gz
openshift-74730c426025286766971113dd40cc6bf3719267.tar.bz2
openshift-74730c426025286766971113dd40cc6bf3719267.tar.xz
openshift-74730c426025286766971113dd40cc6bf3719267.zip
Only try to yaml.load a file if it ends in .yml or .yaml in logging facts
Diffstat (limited to 'roles')
-rw-r--r--roles/openshift_logging/library/openshift_logging_facts.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/roles/openshift_logging/library/openshift_logging_facts.py b/roles/openshift_logging/library/openshift_logging_facts.py
index 37ffb0204..a7f9fdc8e 100644
--- a/roles/openshift_logging/library/openshift_logging_facts.py
+++ b/roles/openshift_logging/library/openshift_logging_facts.py
@@ -208,9 +208,10 @@ class OpenshiftLoggingFacts(OCBaseCommand):
def facts_from_configmap(self, comp, kind, name, config_key, yaml_file=None):
'''Extracts facts in logging namespace from configmap'''
if yaml_file is not None:
- config_facts = yaml.load(yaml_file)
- self.facts[comp][kind][name][config_key] = config_facts
- self.facts[comp][kind][name]["raw"] = yaml_file
+ if config_key.endswith(".yml") or config_key.endswith(".yaml"):
+ config_facts = yaml.load(yaml_file)
+ self.facts[comp][kind][name][config_key] = config_facts
+ self.facts[comp][kind][name][config_key]["raw"] = yaml_file
def facts_for_configmaps(self, namespace):
''' Gathers facts for configmaps in logging namespace '''