Merge "Using yaml.safe_load instead of yaml.load"

This commit is contained in:
Jenkins 2017-02-10 05:38:03 +00:00 committed by Gerrit Code Review
commit a5f0df55af
2 changed files with 3 additions and 3 deletions

View File

@ -49,7 +49,7 @@ function get_includes {
/opt/ansible-runtime/bin/python <<EOC
import yaml
with open("${1}") as f:
yaml_list = yaml.load(f.read())
yaml_list = yaml.safe_load(f.read())
for item in yaml_list:
_item = '---\n' + yaml.safe_dump([item], default_flow_style=False, width=1000)
print(repr(_item).strip("'").strip('"'))
@ -60,7 +60,7 @@ function get_include_file {
/opt/ansible-runtime/bin/python <<EOC
import yaml
with open("${1}") as f:
yaml_list = yaml.load(f.read())
yaml_list = yaml.safe_load(f.read())
print(yaml_list[0]['include'])
EOC
}

View File

@ -1306,7 +1306,7 @@ class TestInventoryGroupConstraints(unittest.TestCase):
- compute_hosts
"""
bad_env = yaml.load(override)
bad_env = yaml.safe_load(override)
# This is essentially what load_environment does, after all the file
# system walking