Skip to content

Commit

Permalink
Now fails if comment cannot be updated.
Browse files Browse the repository at this point in the history
This was silently ignored in the past.
  • Loading branch information
felixfontein committed Aug 12, 2023
1 parent 57844d2 commit d835198
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/646-openssh-rc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
bugfixes:
- "openssh_cert, openssh_keypair - the modules ignored return codes of ``ssh`` and ``ssh-keygen`` in some cases (https://github.com/ansible-collections/community.crypto/issues/645, https://github.com/ansible-collections/community.crypto/pull/646)."
- "openssh_keypair - fix comment updating for OpenSSH before 6.5 (https://github.com/ansible-collections/community.crypto/pull/646)."
minor_changes:
- "openssh_keypair - fail when comment cannot be updated (https://github.com/ansible-collections/community.crypto/pull/646)."
9 changes: 9 additions & 0 deletions tests/integration/targets/openssh_keypair/tests/options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
comment: "test_modified@comment"
backend: "{{ backend }}"
register: modified_comment_output
ignore_errors: true

- name: "({{ backend }}) Assert comment preserved public key - comment"
assert:
Expand All @@ -111,9 +112,17 @@
assert:
that:
- modified_comment_output.comment == 'test_modified@comment'
- modified_comment_output is succeeded
# Support for updating comments for key types other than rsa1 was added in OpenSSH 7.2
when: not (backend == 'opensshbin' and openssh_version is version('7.2', '<'))

- name: "({{ backend }}) Assert comment not changed - comment"
assert:
that:
- modified_comment_output is failed
# Support for updating comments for key types other than rsa1 was added in OpenSSH 7.2
when: backend == 'opensshbin' and openssh_version is version('7.2', '<')

- name: "({{ backend }}) Remove key - comment"
openssh_keypair:
path: "{{ remote_tmp_dir }}/comment"
Expand Down

0 comments on commit d835198

Please sign in to comment.