diff --git a/deployment/catalog-ci-jenkins/modules/catalog_ci/files/scripts/generate_names.py b/deployment/catalog-ci-jenkins/modules/catalog_ci/files/scripts/generate_names.py index 0d82412..6468abd 100755 --- a/deployment/catalog-ci-jenkins/modules/catalog_ci/files/scripts/generate_names.py +++ b/deployment/catalog-ci-jenkins/modules/catalog_ci/files/scripts/generate_names.py @@ -19,7 +19,7 @@ import yaml def yaml_to_dict(infile, k): stream = open(infile, 'r') - rdict = yaml.load(stream)[k] + rdict = yaml.safe_load(stream)[k] return rdict diff --git a/openstack_catalog/tests/test_openstack_catalog.py b/openstack_catalog/tests/test_openstack_catalog.py index 5c067ed..2ce5f77 100644 --- a/openstack_catalog/tests/test_openstack_catalog.py +++ b/openstack_catalog/tests/test_openstack_catalog.py @@ -39,7 +39,7 @@ class TestOpenstack_catalog(testtools.TestCase): return content_file.read() def _read_file(self, file_name): - return yaml.load(self._read_raw_file(file_name)) + return yaml.safe_load(self._read_raw_file(file_name)) def _verify_by_schema(self, file_name, schema): data = self._read_file(file_name) diff --git a/tools/asset_history.sh b/tools/asset_history.sh index 32d8232..97a1926 100755 --- a/tools/asset_history.sh +++ b/tools/asset_history.sh @@ -3,7 +3,7 @@ asset_file="$1" awk '{line+=1}/^ -/{end=line-1; if(start > 0){print start "," end}; count+=1;start=line;}END{print start "," line}' "$asset_file" | while read line; do size=`echo $line | awk -F, '{print $2-$1+1}'` end=`echo $line | awk -F, '{print $2}'` - name=`head -n $end "$asset_file" | tail -n $size | python -c 'import yaml,sys; print yaml.load(sys.stdin)[0]["name"]'` + name=`head -n $end "$asset_file" | tail -n $size | python -c 'import yaml,sys; print yaml.safe_load(sys.stdin)[0]["name"]'` date=`git blame -w -L $line "$asset_file" | sed 's/^[^(]*(\([^)]*\)).*/\1/' | python -c 'import sys,dateutil.parser; print max([dateutil.parser.parse("%s %s%s"%(j[0], j[1], j[2])) for j in [i.split()[-4:] for i in sys.stdin.readlines()]])'` #Dump out the name of the asset, and the last modified date as a json doc to stdout to be reassembled outside the loop into one document (echo $name; echo $date) | python -c 'import sys,json; print json.dumps([i.strip() for i in sys.stdin.readlines()]),' diff --git a/tools/check_app_catalog_yaml.py b/tools/check_app_catalog_yaml.py index dc0786a..9ac9f24 100755 --- a/tools/check_app_catalog_yaml.py +++ b/tools/check_app_catalog_yaml.py @@ -106,7 +106,7 @@ def main(): yaml.add_representer(OrderedDict, project_representer, Dumper=IndentedDumper) - data = yaml.load(open('openstack_catalog/web/static/assets.yaml')) + data = yaml.safe_load(open('openstack_catalog/web/static/assets.yaml')) assets = [] for a in data['assets']: diff --git a/tools/yaml2json.py b/tools/yaml2json.py index d135eef..c2eec35 100644 --- a/tools/yaml2json.py +++ b/tools/yaml2json.py @@ -36,9 +36,9 @@ def dict_merge(a, b): merge = {} for f in args.files: - merge = dict_merge(merge, yaml.load(open(f))['assets']) + merge = dict_merge(merge, yaml.safe_load(open(f))['assets']) -y = yaml.load(sys.stdin) +y = yaml.safe_load(sys.stdin) for a in y['assets']: s = a['service'] if s['type'] == 'heat':