summaryrefslogtreecommitdiffstats
path: root/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
diff options
context:
space:
mode:
authorvamahaja <vamahaja@redhat.com>2020-01-16 10:26:58 +0530
committervamahaja <vamahaja@redhat.com>2020-01-16 14:31:41 +0530
commite20e2dfa6539c9b7d168043c752aa10962693d56 (patch)
tree8a16619a5d70e5160353c725ef46a445e229e85b /openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
parent525601e334368de09cdf892b9002e903b3f9cbd6 (diff)
Fix 'yaml.load' which gives warnings
As per documenton [1], 'yaml.load(raw_data)' is deprecated and suggested to use parameter 'Loader=yaml.FullLoader'. Fix such instances of yaml.load in functions - oc_get_yaml, get_events and enable_pvc_resize [1] 'https://github.com/yaml/pyyaml/wiki/PyYAML-yaml.load(input)-Deprecation' Change-Id: I1fc5544f6f7f12b55e420486b4460f26db214139 Signed-off-by: vamahaja <vamahaja@redhat.com>
Diffstat (limited to 'openshift-storage-libs/openshiftstoragelibs/openshift_ops.py')
-rw-r--r--openshift-storage-libs/openshiftstoragelibs/openshift_ops.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py b/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
index da8225a..1835d9c 100644
--- a/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
+++ b/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
@@ -567,7 +567,7 @@ def oc_get_yaml(ocp_node, rtype, name=None, raise_on_error=True):
cmd.append(name)
out = command.cmd_run(
cmd, hostname=ocp_node, raise_on_error=raise_on_error)
- return yaml.load(out) if out else {}
+ return yaml.load(out, Loader=yaml.FullLoader) if out else {}
def oc_get_pvc(ocp_node, name):
@@ -1460,7 +1460,8 @@ def get_events(hostname,
cmd = "oc get events -o yaml"
if openshift_version.get_openshift_version() >= '3.9':
cmd += " --field-selector %s" % ",".join(field_selector or "''")
- objects = yaml.load(command.cmd_run(cmd, hostname=hostname))['items']
+ get_objects = command.cmd_run(cmd, hostname=hostname)
+ objects = yaml.load(get_objects, Loader=yaml.FullLoader)['items']
if openshift_version.get_openshift_version() >= '3.9':
return objects