1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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

This commit is contained in:
Lujeni 2016-12-30 16:34:18 +01:00 committed by Ryan Brown
parent a5145a41a8
commit 427cfd6162

View file

@ -162,10 +162,13 @@ def dup_check(module, iam, name, new_name, cert, orig_cert_names, orig_cert_bodi
except NameError: except NameError:
continue continue
else: 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 update=True
break 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' module.fail_json(changed=False, msg='A cert with the name %s already exists and'
' has a different certificate body associated' ' has a different certificate body associated'
' with it. Certificates cannot have the same name' % i_name) ' with it. Certificates cannot have the same name' % i_name)