diff options
author | Jose A. Rivera <jarrpa@redhat.com> | 2017-04-03 14:20:41 -0500 |
---|---|---|
committer | Jose A. Rivera <jarrpa@redhat.com> | 2017-04-03 14:45:54 -0500 |
commit | c6b86225e3a5773a77a759c94503cbc079ea0f0a (patch) | |
tree | 1492ae248bd9e67ca1557f1f9c4ac13cc2f9858a /roles/lib_openshift/library | |
parent | 0bac74c346bb5c620bdf1941b40c29ff3083e2b0 (diff) | |
download | openshift-c6b86225e3a5773a77a759c94503cbc079ea0f0a.tar.gz openshift-c6b86225e3a5773a77a759c94503cbc079ea0f0a.tar.bz2 openshift-c6b86225e3a5773a77a759c94503cbc079ea0f0a.tar.xz openshift-c6b86225e3a5773a77a759c94503cbc079ea0f0a.zip |
oc_label: handle case where _get() returns no results
Signed-off-by: Jose A. Rivera <jarrpa@redhat.com>
Diffstat (limited to 'roles/lib_openshift/library')
-rw-r--r-- | roles/lib_openshift/library/oc_label.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/roles/lib_openshift/library/oc_label.py b/roles/lib_openshift/library/oc_label.py index 62b6049c4..5fbbabe4f 100644 --- a/roles/lib_openshift/library/oc_label.py +++ b/roles/lib_openshift/library/oc_label.py @@ -1551,9 +1551,9 @@ class OCLabel(OpenShiftCLI): label_list = [] if self.name: - result = self._get(resource=self.kind, rname=self.name, selector=self.selector) + result = self._get(resource=self.kind, rname=self.name) - if 'labels' in result['results'][0]['metadata']: + if result['results'][0] and 'labels' in result['results'][0]['metadata']: label_list.append(result['results'][0]['metadata']['labels']) else: label_list.append({}) |