Use yaml.safe_load

See #718 for rationale.
This commit is contained in:
ramnes 2019-01-08 23:06:58 +01:00 committed by Haowei Cai
parent 392aa5b9f9
commit 273e0b5db9
2 changed files with 2 additions and 2 deletions

View File

@ -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")

View File

@ -50,7 +50,7 @@ spec:
- 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)