parent
8ec28a2ba4
commit
5258e6d52a
4 changed files with 5 additions and 5 deletions
|
@ -170,7 +170,7 @@ def main():
|
||||||
for cfg_file in config_files:
|
for cfg_file in config_files:
|
||||||
if os.path.isfile(cfg_file):
|
if os.path.isfile(cfg_file):
|
||||||
stream = open(cfg_file, 'r')
|
stream = open(cfg_file, 'r')
|
||||||
config = yaml.load(stream)
|
config = yaml.safe_load(stream)
|
||||||
break
|
break
|
||||||
if not config:
|
if not config:
|
||||||
sys.stderr.write("No config file found at {}\n".format(config_files))
|
sys.stderr.write("No config file found at {}\n".format(config_files))
|
||||||
|
|
|
@ -132,7 +132,7 @@ def content_to_dict(module, content):
|
||||||
# elif format in ['yaml', 'var']:
|
# elif format in ['yaml', 'var']:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
content_dict = yaml.load(content)
|
content_dict = yaml.safe_load(content)
|
||||||
|
|
||||||
if not isinstance(content_dict, dict):
|
if not isinstance(content_dict, dict):
|
||||||
raise
|
raise
|
||||||
|
|
|
@ -146,7 +146,7 @@ class CloudStackFacts(object):
|
||||||
def _get_user_data_json(self):
|
def _get_user_data_json(self):
|
||||||
try:
|
try:
|
||||||
# this data come form users, we try what we can to parse it...
|
# this data come form users, we try what we can to parse it...
|
||||||
return yaml.load(self._fetch(CS_USERDATA_BASE_URL))
|
return yaml.safe_load(self._fetch(CS_USERDATA_BASE_URL))
|
||||||
except:
|
except:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
@ -347,13 +347,13 @@ def main():
|
||||||
|
|
||||||
if inline_data:
|
if inline_data:
|
||||||
if not isinstance(inline_data, dict) and not isinstance(inline_data, list):
|
if not isinstance(inline_data, dict) and not isinstance(inline_data, list):
|
||||||
data = yaml.load(inline_data)
|
data = yaml.safe_load(inline_data)
|
||||||
else:
|
else:
|
||||||
data = inline_data
|
data = inline_data
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
f = open(file_reference, "r")
|
f = open(file_reference, "r")
|
||||||
data = [x for x in yaml.load_all(f)]
|
data = [x for x in yaml.safe_load_all(f)]
|
||||||
f.close()
|
f.close()
|
||||||
if not data:
|
if not data:
|
||||||
module.fail_json(msg="No valid data could be found.")
|
module.fail_json(msg="No valid data could be found.")
|
||||||
|
|
Loading…
Reference in a new issue