Skip to content

Commit

Permalink
Use yaml.safe_load
Browse files Browse the repository at this point in the history
See #718 for rationale.
  • Loading branch information
ramnes committed Jan 8, 2019
1 parent 30c3522 commit 116e652
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/create_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def main():
config.load_kube_config()

with open(path.join(path.dirname(__file__), "nginx-deployment.yaml")) as f:
dep = yaml.load(f)
dep = yaml.safe_load(f)
k8s_beta = client.ExtensionsV1beta1Api()
resp = k8s_beta.create_namespaced_deployment(
body=dep, namespace="default")
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/e2e_test/test_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_create_deployment(self):
- containerPort: 80
'''
resp = api.create_namespaced_deployment(
body=yaml.load(deployment % name),
body=yaml.safe_load(deployment % name),
namespace="default")
resp = api.read_namespaced_deployment(name, 'default')
self.assertIsNotNone(resp)
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/utils/create_from_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def create_from_yaml(k8s_client, yaml_file, verbose=False, **kwargs):
"""

with open(path.abspath(yaml_file)) as f:
yml_object = yaml.load(f)
yml_object = yaml.safe_load(f)
# TODO: case of yaml file containing multiple objects
group, _, version = yml_object["apiVersion"].partition("/")
if version == "":
Expand Down

0 comments on commit 116e652

Please sign in to comment.