Permalink
Browse files

Fix the certificates bodies compare into iam_cert module (#19684)

  • Loading branch information...
Lujeni authored and ryansb committed Dec 30, 2016
1 parent a5145a4 commit 427cfd61620fb3fa423b7c06f4a2a0866796ca77
Showing with 5 additions and 2 deletions.
  1. +5 −2 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)

0 comments on commit 427cfd6

Please sign in to comment.