mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-05-06 05:12:54 +00:00
openssh_* modules: check return code on ssh(-keygen) invocations; fail if comment cannot be updated (#646)
* Check return code on ssh(-keygen) invocations. * openssh_cert: only check for errors if certificate should be present and module is not in check mode. * Handle rc check for _get_private_key(). * Add changelog fragment. * Only pass -o for comment updating when necessary. * Now fails if comment cannot be updated. This was silently ignored in the past. * Avoid failing operation.
This commit is contained in:
@@ -497,7 +497,10 @@ class Certificate(OpensshModule):
|
||||
if self.state != 'present':
|
||||
return {}
|
||||
|
||||
certificate_info = self.ssh_keygen.get_certificate_info(self.path)[1]
|
||||
certificate_info = self.ssh_keygen.get_certificate_info(
|
||||
self.path,
|
||||
check_rc=self.state == 'present' and not self.module.check_mode,
|
||||
)[1]
|
||||
|
||||
return {
|
||||
'type': self.type,
|
||||
|
||||
Reference in New Issue
Block a user