Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle HTTP 404 Not Found errors when state == absent (resolves #253) #264

Merged
merged 1 commit into from
Jun 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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