Skip to content

Commit

Permalink
Merge pull request #3968 from jarrpa/oc_obj-kinds
Browse files Browse the repository at this point in the history
Merged by openshift-bot
  • Loading branch information
OpenShift Bot committed Apr 25, 2017
2 parents d4d1437 + 914200d commit d5ec349
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
11 changes: 4 additions & 7 deletions roles/lib_openshift/library/oc_obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
aliases: []
kind:
description:
- The kind attribute of the object. e.g. dc, bc, svc, route
- The kind attribute of the object. e.g. dc, bc, svc, route. May be a comma-separated list, e.g. "dc,po,svc".
required: True
default: None
aliases: []
Expand Down Expand Up @@ -1546,12 +1546,9 @@ def run_ansible(params, check_mode=False):
# Delete
########
if state == 'absent':
# if we were passed a name, verify its not in our results
if params['name'] is not None and not Utils.exists(api_rval['results'], params['name']):
return {'changed': False, 'state': state}

# verify results are empty for the selector
if params['selector'] is not None and len(api_rval['results']) == 0:
# 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].getattr('items', [])) == 0):
return {'changed': False, 'state': state}

if check_mode:
Expand Down
9 changes: 3 additions & 6 deletions roles/lib_openshift/src/class/oc_obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,9 @@ def run_ansible(params, check_mode=False):
# Delete
########
if state == 'absent':
# if we were passed a name, verify its not in our results
if params['name'] is not None and not Utils.exists(api_rval['results'], params['name']):
return {'changed': False, 'state': state}

# verify results are empty for the selector
if params['selector'] is not None and len(api_rval['results']) == 0:
# 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].getattr('items', [])) == 0):
return {'changed': False, 'state': state}

if check_mode:
Expand Down
2 changes: 1 addition & 1 deletion roles/lib_openshift/src/doc/obj
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ options:
aliases: []
kind:
description:
- The kind attribute of the object. e.g. dc, bc, svc, route
- The kind attribute of the object. e.g. dc, bc, svc, route. May be a comma-separated list, e.g. "dc,po,svc".
required: True
default: None
aliases: []
Expand Down

0 comments on commit d5ec349

Please sign in to comment.