Merge "Using yaml.safe_load instead of yaml.load"
This commit is contained in:
commit
a5f0df55af
@ -49,7 +49,7 @@ function get_includes {
|
|||||||
/opt/ansible-runtime/bin/python <<EOC
|
/opt/ansible-runtime/bin/python <<EOC
|
||||||
import yaml
|
import yaml
|
||||||
with open("${1}") as f:
|
with open("${1}") as f:
|
||||||
yaml_list = yaml.load(f.read())
|
yaml_list = yaml.safe_load(f.read())
|
||||||
for item in yaml_list:
|
for item in yaml_list:
|
||||||
_item = '---\n' + yaml.safe_dump([item], default_flow_style=False, width=1000)
|
_item = '---\n' + yaml.safe_dump([item], default_flow_style=False, width=1000)
|
||||||
print(repr(_item).strip("'").strip('"'))
|
print(repr(_item).strip("'").strip('"'))
|
||||||
@ -60,7 +60,7 @@ function get_include_file {
|
|||||||
/opt/ansible-runtime/bin/python <<EOC
|
/opt/ansible-runtime/bin/python <<EOC
|
||||||
import yaml
|
import yaml
|
||||||
with open("${1}") as f:
|
with open("${1}") as f:
|
||||||
yaml_list = yaml.load(f.read())
|
yaml_list = yaml.safe_load(f.read())
|
||||||
print(yaml_list[0]['include'])
|
print(yaml_list[0]['include'])
|
||||||
EOC
|
EOC
|
||||||
}
|
}
|
||||||
|
@ -1306,7 +1306,7 @@ class TestInventoryGroupConstraints(unittest.TestCase):
|
|||||||
- compute_hosts
|
- compute_hosts
|
||||||
"""
|
"""
|
||||||
|
|
||||||
bad_env = yaml.load(override)
|
bad_env = yaml.safe_load(override)
|
||||||
|
|
||||||
# This is essentially what load_environment does, after all the file
|
# This is essentially what load_environment does, after all the file
|
||||||
# system walking
|
# system walking
|
||||||
|
Loading…
Reference in New Issue
Block a user