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

[PR #7795/31de16ce backport][stable-7] ipa_otptoken: fix wrong return value string to bool (#7851)

ipa_otptoken: fix wrong return value string to bool (#7795)

ipa_data is return ipatokendisable in boolean format and the module expects it as a string
this behavior causes a lack of idempotency and the get_diff module will fail in the second run.

(cherry picked from commit 31de16cee3)

Co-authored-by: Parsa Yousefi <p.yousefi97@gmail.com>
This commit is contained in:
patchback[bot] 2024-01-16 22:31:44 +01:00 committed by GitHub
parent 871829dd97
commit fef1a495e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 12 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- ipa_otptoken - the module expect ``ipatokendisabled`` as string but the ``ipatokendisabled`` value is returned as a boolean (https://github.com/ansible-collections/community.general/pull/7795).

View file

@ -237,7 +237,7 @@ def get_otptoken_dict(ansible_to_ipa, uniqueid=None, newuniqueid=None, otptype=N
if owner is not None: if owner is not None:
otptoken[ansible_to_ipa['owner']] = owner otptoken[ansible_to_ipa['owner']] = owner
if enabled is not None: if enabled is not None:
otptoken[ansible_to_ipa['enabled']] = 'FALSE' if enabled else 'TRUE' otptoken[ansible_to_ipa['enabled']] = False if enabled else True
if notbefore is not None: if notbefore is not None:
otptoken[ansible_to_ipa['notbefore']] = notbefore + 'Z' otptoken[ansible_to_ipa['notbefore']] = notbefore + 'Z'
if notafter is not None: if notafter is not None:

View file

@ -104,7 +104,7 @@ class TestIPAOTPToken(ModuleTestCase):
{ {
'method': 'otptoken_add', 'method': 'otptoken_add',
'name': 'NewToken1', 'name': 'NewToken1',
'item': {'ipatokendisabled': 'FALSE', 'item': {'ipatokendisabled': False,
'all': True} 'all': True}
} }
) )
@ -130,7 +130,7 @@ class TestIPAOTPToken(ModuleTestCase):
{ {
'method': 'otptoken_add', 'method': 'otptoken_add',
'name': 'NewToken1', 'name': 'NewToken1',
'item': {'ipatokendisabled': 'FALSE', 'item': {'ipatokendisabled': False,
'all': True} 'all': True}
} }
) )
@ -176,7 +176,7 @@ class TestIPAOTPToken(ModuleTestCase):
'ipatokenotpkey': 'KRSXG5CTMVRXEZLUGE======', 'ipatokenotpkey': 'KRSXG5CTMVRXEZLUGE======',
'description': 'Test description', 'description': 'Test description',
'ipatokenowner': 'pinky', 'ipatokenowner': 'pinky',
'ipatokendisabled': 'FALSE', 'ipatokendisabled': False,
'ipatokennotbefore': '20200101010101Z', 'ipatokennotbefore': '20200101010101Z',
'ipatokennotafter': '20900101010101Z', 'ipatokennotafter': '20900101010101Z',
'ipatokenvendor': 'Acme', 'ipatokenvendor': 'Acme',
@ -220,7 +220,7 @@ class TestIPAOTPToken(ModuleTestCase):
'ipatokenotpkey': [{'__base64__': 'VGVzdFNlY3JldDE='}], 'ipatokenotpkey': [{'__base64__': 'VGVzdFNlY3JldDE='}],
'description': ['Test description'], 'description': ['Test description'],
'ipatokenowner': ['pinky'], 'ipatokenowner': ['pinky'],
'ipatokendisabled': ['FALSE'], 'ipatokendisabled': [False],
'ipatokennotbefore': ['20200101010101Z'], 'ipatokennotbefore': ['20200101010101Z'],
'ipatokennotafter': ['20900101010101Z'], 'ipatokennotafter': ['20900101010101Z'],
'ipatokenvendor': ['Acme'], 'ipatokenvendor': ['Acme'],
@ -271,7 +271,7 @@ class TestIPAOTPToken(ModuleTestCase):
'ipatokenotpkey': [{'__base64__': 'VGVzdFNlY3JldDE='}], 'ipatokenotpkey': [{'__base64__': 'VGVzdFNlY3JldDE='}],
'description': ['Test description'], 'description': ['Test description'],
'ipatokenowner': ['pinky'], 'ipatokenowner': ['pinky'],
'ipatokendisabled': ['FALSE'], 'ipatokendisabled': [False],
'ipatokennotbefore': ['20200101010101Z'], 'ipatokennotbefore': ['20200101010101Z'],
'ipatokennotafter': ['20900101010101Z'], 'ipatokennotafter': ['20900101010101Z'],
'ipatokenvendor': ['Acme'], 'ipatokenvendor': ['Acme'],
@ -296,7 +296,7 @@ class TestIPAOTPToken(ModuleTestCase):
'name': 'NewToken1', 'name': 'NewToken1',
'item': {'description': 'Test description', 'item': {'description': 'Test description',
'ipatokenowner': 'brain', 'ipatokenowner': 'brain',
'ipatokendisabled': 'FALSE', 'ipatokendisabled': False,
'ipatokennotbefore': '20200101010101Z', 'ipatokennotbefore': '20200101010101Z',
'ipatokennotafter': '20900101010101Z', 'ipatokennotafter': '20900101010101Z',
'ipatokenvendor': 'Acme', 'ipatokenvendor': 'Acme',
@ -335,7 +335,7 @@ class TestIPAOTPToken(ModuleTestCase):
'ipatokenotpkey': [{'__base64__': 'VGVzdFNlY3JldDE='}], 'ipatokenotpkey': [{'__base64__': 'VGVzdFNlY3JldDE='}],
'description': ['Test description'], 'description': ['Test description'],
'ipatokenowner': ['pinky'], 'ipatokenowner': ['pinky'],
'ipatokendisabled': ['FALSE'], 'ipatokendisabled': [False],
'ipatokennotbefore': ['20200101010101Z'], 'ipatokennotbefore': ['20200101010101Z'],
'ipatokennotafter': ['20900101010101Z'], 'ipatokennotafter': ['20900101010101Z'],
'ipatokenvendor': ['Acme'], 'ipatokenvendor': ['Acme'],
@ -360,7 +360,7 @@ class TestIPAOTPToken(ModuleTestCase):
'name': 'NewToken1', 'name': 'NewToken1',
'item': {'description': 'New Test description', 'item': {'description': 'New Test description',
'ipatokenowner': 'pinky', 'ipatokenowner': 'pinky',
'ipatokendisabled': 'TRUE', 'ipatokendisabled': True,
'ipatokennotbefore': '20200101010102Z', 'ipatokennotbefore': '20200101010102Z',
'ipatokennotafter': '20900101010102Z', 'ipatokennotafter': '20900101010102Z',
'ipatokenvendor': 'NewAcme', 'ipatokenvendor': 'NewAcme',
@ -384,7 +384,7 @@ class TestIPAOTPToken(ModuleTestCase):
'ipatokenotpkey': [{'__base64__': 'KRSXG5CTMVRXEZLUGE======'}], 'ipatokenotpkey': [{'__base64__': 'KRSXG5CTMVRXEZLUGE======'}],
'description': ['Test description'], 'description': ['Test description'],
'ipatokenowner': ['pinky'], 'ipatokenowner': ['pinky'],
'ipatokendisabled': ['FALSE'], 'ipatokendisabled': [False],
'ipatokennotbefore': ['20200101010101Z'], 'ipatokennotbefore': ['20200101010101Z'],
'ipatokennotafter': ['20900101010101Z'], 'ipatokennotafter': ['20900101010101Z'],
'ipatokenvendor': ['Acme'], 'ipatokenvendor': ['Acme'],
@ -425,7 +425,7 @@ class TestIPAOTPToken(ModuleTestCase):
'ipatokenotpkey': [{'__base64__': 'KRSXG5CTMVRXEZLUGE======'}], 'ipatokenotpkey': [{'__base64__': 'KRSXG5CTMVRXEZLUGE======'}],
'description': ['Test description'], 'description': ['Test description'],
'ipatokenowner': ['pinky'], 'ipatokenowner': ['pinky'],
'ipatokendisabled': ['FALSE'], 'ipatokendisabled': [False],
'ipatokennotbefore': ['20200101010101Z'], 'ipatokennotbefore': ['20200101010101Z'],
'ipatokennotafter': ['20900101010101Z'], 'ipatokennotafter': ['20900101010101Z'],
'ipatokenvendor': ['Acme'], 'ipatokenvendor': ['Acme'],
@ -448,7 +448,7 @@ class TestIPAOTPToken(ModuleTestCase):
{ {
'method': 'otptoken_mod', 'method': 'otptoken_mod',
'name': 'NewToken1', 'name': 'NewToken1',
'item': {'ipatokendisabled': 'TRUE', 'item': {'ipatokendisabled': True,
'all': True} 'all': True}
} }
) )