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

Fix the certificates bodies compare into iam_cert module #19684

Merged
merged 1 commit into from
Dec 30, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/ansible/modules/cloud/amazon/iam_cert.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,13 @@ def dup_check(module, iam, name, new_name, cert, orig_cert_names, orig_cert_bodi
except NameError:
continue
else:
if orig_cert_bodies[c_index] == cert:
# NOTE: remove the carriage return to strictly compare the cert bodies.
slug_cert = cert.replace('\r', '')
slug_orig_cert_bodies = orig_cert_bodies[c_index].replace('\r', '')
if slug_orig_cert_bodies == slug_cert:
update=True
break
elif orig_cert_bodies[c_index] != cert:
elif slug_orig_cert_bodies != slug_cert:
module.fail_json(changed=False, msg='A cert with the name %s already exists and'
' has a different certificate body associated'
' with it. Certificates cannot have the same name' % i_name)
Expand Down