Skip to content

Commit 116e652

Browse files
committed
Use yaml.safe_load
See #718 for rationale.
1 parent 30c3522 commit 116e652

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

examples/create_deployment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def main():
2626
config.load_kube_config()
2727

2828
with open(path.join(path.dirname(__file__), "nginx-deployment.yaml")) as f:
29-
dep = yaml.load(f)
29+
dep = yaml.safe_load(f)
3030
k8s_beta = client.ExtensionsV1beta1Api()
3131
resp = k8s_beta.create_namespaced_deployment(
3232
body=dep, namespace="default")

kubernetes/e2e_test/test_extensions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def test_create_deployment(self):
5050
- containerPort: 80
5151
'''
5252
resp = api.create_namespaced_deployment(
53-
body=yaml.load(deployment % name),
53+
body=yaml.safe_load(deployment % name),
5454
namespace="default")
5555
resp = api.read_namespaced_deployment(name, 'default')
5656
self.assertIsNotNone(resp)

kubernetes/utils/create_from_yaml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def create_from_yaml(k8s_client, yaml_file, verbose=False, **kwargs):
3939
"""
4040

4141
with open(path.abspath(yaml_file)) as f:
42-
yml_object = yaml.load(f)
42+
yml_object = yaml.safe_load(f)
4343
# TODO: case of yaml file containing multiple objects
4444
group, _, version = yml_object["apiVersion"].partition("/")
4545
if version == "":

0 commit comments

Comments
 (0)