diff options
author | Lujeni <julien@thebault.co> | 2016-12-30 16:34:18 +0100 |
---|---|---|
committer | Ryan Brown <sb@ryansb.com> | 2016-12-30 10:34:18 -0500 |
commit | 427cfd61620fb3fa423b7c06f4a2a0866796ca77 (patch) | |
tree | f9737698a6777470d985e89cac216e570b4bf94c /lib/ansible/modules/cloud/amazon/iam_cert.py | |
parent | a5145a41a863643f8fa63a0ff975595b2148c1e9 (diff) | |
download | ansible-427cfd61620fb3fa423b7c06f4a2a0866796ca77.tar.gz |
Fix the certificates bodies compare into iam_cert module (#19684)
Diffstat (limited to 'lib/ansible/modules/cloud/amazon/iam_cert.py')
-rw-r--r-- | lib/ansible/modules/cloud/amazon/iam_cert.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/ansible/modules/cloud/amazon/iam_cert.py b/lib/ansible/modules/cloud/amazon/iam_cert.py index 6e71b5552f..9fc3678770 100644 --- a/lib/ansible/modules/cloud/amazon/iam_cert.py +++ b/lib/ansible/modules/cloud/amazon/iam_cert.py @@ -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) |