diff options
author | Jose A. Rivera <jarrpa@redhat.com> | 2017-06-06 00:39:35 -0500 |
---|---|---|
committer | Jose A. Rivera <jarrpa@redhat.com> | 2017-06-06 21:32:42 -0500 |
commit | e089f74edc79a31117a49d3f84519974787f31f0 (patch) | |
tree | 41fabc94997fc0843d4ad34da942a577df78b49a | |
parent | a39fc605318d359533c7dba343f557f7005db17d (diff) | |
download | openshift-e089f74edc79a31117a49d3f84519974787f31f0.tar.gz openshift-e089f74edc79a31117a49d3f84519974787f31f0.tar.bz2 openshift-e089f74edc79a31117a49d3f84519974787f31f0.tar.xz openshift-e089f74edc79a31117a49d3f84519974787f31f0.zip |
oc_obj: only check 'items' if exists in delete
Signed-off-by: Jose A. Rivera <jarrpa@redhat.com>
-rw-r--r-- | roles/lib_openshift/library/oc_obj.py | 3 | ||||
-rw-r--r-- | roles/lib_openshift/src/class/oc_obj.py | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/roles/lib_openshift/library/oc_obj.py b/roles/lib_openshift/library/oc_obj.py index 215723cc8..c63441aa3 100644 --- a/roles/lib_openshift/library/oc_obj.py +++ b/roles/lib_openshift/library/oc_obj.py @@ -1557,7 +1557,8 @@ class OCObject(OpenShiftCLI): if state == 'absent': # verify its not in our results if (params['name'] is not None or params['selector'] is not None) and \ - (len(api_rval['results']) == 0 or len(api_rval['results'][0].get('items', [])) == 0): + (len(api_rval['results']) == 0 or \ + ('items' in api_rval['results'][0] and len(api_rval['results'][0]['items']) == 0)): return {'changed': False, 'state': state} if check_mode: diff --git a/roles/lib_openshift/src/class/oc_obj.py b/roles/lib_openshift/src/class/oc_obj.py index 6f0da3d5c..d480bfaf0 100644 --- a/roles/lib_openshift/src/class/oc_obj.py +++ b/roles/lib_openshift/src/class/oc_obj.py @@ -117,7 +117,8 @@ class OCObject(OpenShiftCLI): if state == 'absent': # verify its not in our results if (params['name'] is not None or params['selector'] is not None) and \ - (len(api_rval['results']) == 0 or len(api_rval['results'][0].get('items', [])) == 0): + (len(api_rval['results']) == 0 or \ + ('items' in api_rval['results'][0] and len(api_rval['results'][0]['items']) == 0)): return {'changed': False, 'state': state} if check_mode: |