Switch to yaml.safe_load
We only deal with simple types.
Change-Id: Ic902b19dc8db9d0e1e3dab0909dfd2400a169c49
diff --git a/tests/make_playbooks.py b/tests/make_playbooks.py
index 12d9e71..33d45ca 100755
--- a/tests/make_playbooks.py
+++ b/tests/make_playbooks.py
@@ -39,7 +39,7 @@
if os.path.exists(os.path.join(path, fn)):
config_path = os.path.join(path, fn)
break
- config = yaml.load(open(config_path))
+ config = yaml.safe_load(open(config_path))
for block in config:
if 'job' not in block:
continue
diff --git a/tests/unit/test_layoutvalidator.py b/tests/unit/test_layoutvalidator.py
index 38c8e29..319bfaa 100644
--- a/tests/unit/test_layoutvalidator.py
+++ b/tests/unit/test_layoutvalidator.py
@@ -56,7 +56,7 @@
connections = zuul.lib.connections.configure_connections(config)
layout = os.path.join(FIXTURE_DIR, 'layouts', fn)
- data = yaml.load(open(layout))
+ data = yaml.safe_load(open(layout))
validator = zuul.layoutvalidator.LayoutValidator()
if m.group(1) == 'good':
try:
diff --git a/zuul/configloader.py b/zuul/configloader.py
index 50d6143..918997c 100644
--- a/zuul/configloader.py
+++ b/zuul/configloader.py
@@ -756,7 +756,7 @@
def _parseConfigRepoLayout(data, source_context):
# This is the top-level configuration for a tenant.
config = model.UnparsedTenantConfig()
- config.extend(yaml.load(data), source_context)
+ config.extend(yaml.safe_load(data), source_context)
return config
@staticmethod
@@ -764,7 +764,7 @@
# TODOv3(jeblair): this should implement some rules to protect
# aspects of the config that should not be changed in-repo
config = model.UnparsedTenantConfig()
- config.extend(yaml.load(data), source_context)
+ config.extend(yaml.safe_load(data), source_context)
return config
@@ -814,7 +814,7 @@
config_path = self.expandConfigPath(config_path)
with open(config_path) as config_file:
self.log.info("Loading configuration from %s" % (config_path,))
- data = yaml.load(config_file)
+ data = yaml.safe_load(config_file)
config = model.UnparsedAbideConfig()
config.extend(data)
base = os.path.dirname(os.path.realpath(config_path))
diff --git a/zuul/lib/cloner.py b/zuul/lib/cloner.py
index 197c426..fb5ed42 100644
--- a/zuul/lib/cloner.py
+++ b/zuul/lib/cloner.py
@@ -61,7 +61,7 @@
raise Exception("Unable to read clone map file at %s." %
clone_map_file)
clone_map_file = open(clone_map_file)
- self.clone_map = yaml.load(clone_map_file).get('clonemap')
+ self.clone_map = yaml.safe_load(clone_map_file).get('clonemap')
self.log.info("Loaded map containing %s rules", len(self.clone_map))
return self.clone_map