Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix custom file attributes for public keys #257

Merged
merged 1 commit into from
Jul 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- openssh_keypair - fixed a bug that prevented custom file attributes being applied to public keys (https://github.com/ansible-collections/community.crypto/pull/257).
4 changes: 3 additions & 1 deletion plugins/module_utils/openssh/backends/keypair_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ def generate(self):
self.module.fail_json(msg='Unable to update the comment for the public key.')
self._update_comment()

if self._permissions_changed() or self._permissions_changed(public_key=True):
private_key_perms_changed = self._permissions_changed()
public_key_perms_changed = self._permissions_changed(public_key=True)
if private_key_perms_changed or public_key_perms_changed:
self.changed = True

def is_private_key_valid(self, perms_required=True):
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/openssh_keypair.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
- In case the ssh key is broken or password protected, the module will fail.
Set the I(force) option to C(yes) if you want to regenerate the keypair.
- Supports C(check_mode).
- In the case a custom C(mode), C(group), C(owner), or other file attribute is provided it will be applied to both key files.

extends_documentation_fragment: files
'''
Expand Down