Skip to content

Commit

Permalink
Handle HTTP 404 Not Found errors when state == absent (resolves #253) (
Browse files Browse the repository at this point in the history
…#264)

Signed-off-by: Simon Stone <sstone1@uk.ibm.com>
  • Loading branch information
Simon Stone authored Jun 2, 2020
1 parent cc62add commit 306d5c9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion plugins/modules/certificate_authority.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,10 @@ def main():
if state == 'absent' and certificate_authority_exists:

# The certificate authority should not exist, so delete it.
console.delete_ca(certificate_authority['id'])
if certificate_authority_corrupt:
console.delete_ext_ca(certificate_authority['id'])
else:
console.delete_ca(certificate_authority['id'])
return module.exit_json(changed=True)

elif state == 'absent':
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/external_ordering_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def main():
has_deployment_attrs = False
has_location = False
for ordering_service_node in existing_ordering_service:
if not ordering_service_node.get('deployment_attrs_missing', False):
if 'deployment_attrs_missing' not in ordering_service_node:
has_deployment_attrs = True
break
elif ordering_service_node.get('location', '-') != '-':
Expand Down
5 changes: 4 additions & 1 deletion plugins/modules/peer.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,10 @@ def main():
if state == 'absent' and peer_exists:

# The peer should not exist, so delete it.
console.delete_peer(peer['id'])
if peer_corrupt:
console.delete_ext_peer(peer['id'])
else:
console.delete_peer(peer['id'])
return module.exit_json(changed=True)

elif state == 'absent':
Expand Down

0 comments on commit 306d5c9

Please sign in to comment.