summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGanesh B. Nalawade <gnalawad@redhat.com>2017-09-14 18:06:56 +0200
committerToshio Kuratomi <a.badger@gmail.com>2017-09-14 20:19:00 +0200
commit8c3bf20a13a185e7c5c4bd0dee1bbe0b1ec2eab3 (patch)
treebde66f43c5b31664fde91e3b7de5d9df89eec626
parentalternatives: test that path parameter is checked (diff)
downloadansible-8c3bf20a13a185e7c5c4bd0dee1bbe0b1ec2eab3.tar.xz
ansible-8c3bf20a13a185e7c5c4bd0dee1bbe0b1ec2eab3.zip
Use safe_load to load yaml
Replad `yaml.load` with `yaml.safe_load`
-rw-r--r--lib/ansible/modules/network/aci/aci_rest.py2
-rw-r--r--lib/ansible/modules/network/aos/aos_blueprint_param.py2
-rw-r--r--lib/ansible/plugins/filter/network.py2
3 files changed, 3 insertions, 3 deletions
diff --git a/lib/ansible/modules/network/aci/aci_rest.py b/lib/ansible/modules/network/aci/aci_rest.py
index 3df238a6b1..a4822ad4eb 100644
--- a/lib/ansible/modules/network/aci/aci_rest.py
+++ b/lib/ansible/modules/network/aci/aci_rest.py
@@ -355,7 +355,7 @@ def main():
elif payload and isinstance(payload, str) and HAS_YAML:
try:
# Validate YAML/JSON string
- payload = json.dumps(yaml.load(payload))
+ payload = json.dumps(yaml.safe_load(payload))
except Exception as e:
module.fail_json(msg='Failed to parse provided JSON/YAML content: %s' % to_text(e), exception=to_text(e), payload=payload)
elif rest_type == 'xml' and HAS_LXML_ETREE:
diff --git a/lib/ansible/modules/network/aos/aos_blueprint_param.py b/lib/ansible/modules/network/aos/aos_blueprint_param.py
index 3f40cbc915..d8a0f076d1 100644
--- a/lib/ansible/modules/network/aos/aos_blueprint_param.py
+++ b/lib/ansible/modules/network/aos/aos_blueprint_param.py
@@ -201,7 +201,7 @@ def get_collection_from_param_map(module, aos):
module.fail_json(msg="Python library Yaml is mandatory to use 'param_map'")
try:
- param_map = yaml.load(param_map_json)
+ param_map = yaml.safe_load(param_map_json)
except:
module.fail_json(msg="Unable to parse param_map information")
diff --git a/lib/ansible/plugins/filter/network.py b/lib/ansible/plugins/filter/network.py
index 50952b4fa2..936aa960e8 100644
--- a/lib/ansible/plugins/filter/network.py
+++ b/lib/ansible/plugins/filter/network.py
@@ -78,7 +78,7 @@ def parse_cli(output, tmpl):
except ImportError as exc:
raise AnsibleError(str(exc))
- spec = yaml.load(open(tmpl).read())
+ spec = yaml.safe_load(open(tmpl).read())
obj = {}
for name, attrs in iteritems(spec['keys']):