Merge "Replace yaml.load() with yaml.safe_load()"

This commit is contained in:
Jenkins 2017-01-18 04:08:12 +00:00 committed by Gerrit Code Review
commit f735864b78
4 changed files with 4 additions and 4 deletions

View File

@ -237,7 +237,7 @@ for i in $(find elements -type f -name '*.yaml'); do
import yaml import yaml
import sys import sys
try: try:
objs = yaml.load(open('$i')) objs = yaml.safe_load(open('$i'))
except yaml.parser.ParserError: except yaml.parser.ParserError:
sys.exit(1) sys.exit(1)
" "

View File

@ -59,7 +59,7 @@ def collect_data(data, filename, element_name):
try: try:
objs = json.load(open(filename)) objs = json.load(open(filename))
except ValueError: except ValueError:
objs = yaml.load(open(filename)) objs = yaml.safe_load(open(filename))
for pkg_name, params in objs.items(): for pkg_name, params in objs.items():
if not params: if not params:
params = {} params = {}

View File

@ -24,7 +24,7 @@ def load_service_mapping(filepath="/usr/share/svc-map/services"):
if not os.path.isfile(filepath): if not os.path.isfile(filepath):
return {} return {}
with open(filepath, 'r') as data_file: with open(filepath, 'r') as data_file:
return yaml.load(data_file.read()) return yaml.safe_load(data_file.read())
def main(): def main():

View File

@ -70,7 +70,7 @@ def main():
data_path = os.path.join(element_path, element, "svc-map") data_path = os.path.join(element_path, element, "svc-map")
if os.path.exists(data_path): if os.path.exists(data_path):
with open(data_path, 'r') as dataFile: with open(data_path, 'r') as dataFile:
data = yaml.load(dataFile.read()) data = yaml.safe_load(dataFile.read())
try: try:
service_names = merge_data( service_names = merge_data(
data, data,