mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-03-26 21:33:25 +00:00
openssh_keypair: Populate return values when keypair exists and check_mode=true (#230)
* Swapping statement order for check_mode to initialize return values * Adding changelog fragment * Updated changelog to reflect bugfix
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- openssh_keypair - fix ``check_mode`` to populate return values for existing keypairs (https://github.com/ansible-collections/community.crypto/issues/113, https://github.com/ansible-collections/community.crypto/pull/230).
|
||||
@@ -590,8 +590,9 @@ def main():
|
||||
if keypair.state == 'present':
|
||||
|
||||
if module.check_mode:
|
||||
changed = keypair.force or not keypair.isPrivateKeyValid(module) or not keypair.isPublicKeyValid(module)
|
||||
result = keypair.dump()
|
||||
result['changed'] = keypair.force or not keypair.isPrivateKeyValid(module) or not keypair.isPublicKeyValid(module)
|
||||
result['changed'] = changed
|
||||
module.exit_json(**result)
|
||||
|
||||
try:
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
- privatekey1_result_check is changed
|
||||
- privatekey1_result is changed
|
||||
- privatekey1_idem_result_check is not changed
|
||||
- privatekey1_idem_result_check.public_key.startswith("ssh-rsa")
|
||||
- privatekey1_idem_result is not changed
|
||||
|
||||
- name: Validate privatekey1 return fingerprint
|
||||
|
||||
Reference in New Issue
Block a user