openssh_keypair - Add key ``comment`` to return output (#59268)

If the comment will be provided during the key creation, it will be
diplayed in the return values.
Same will be on the comment change.
pull/60389/head
Maxim Babushkin 5 years ago committed by Felix Fontein
parent 8da48b1a40
commit dda80c46e9

@ -0,0 +1,2 @@
minor_changes:
- openssh_keypair - add key ``comment`` to return value

@ -113,6 +113,11 @@ public_key:
returned: changed or success
type: str
sample: ssh-rsa AAAAB3Nza(...omitted...)veL4E3Xcw== test_key
comment:
description: The comment of the generated key
returned: changed or success
type: str
sample: test@comment
'''
import os
@ -313,6 +318,7 @@ class Keypair(object):
# On removal this has no value
'fingerprint': self.fingerprint[1] if self.fingerprint else '',
'public_key': self.public_key,
'comment': self.comment if self.comment else '',
}
return result

@ -97,3 +97,13 @@
assert:
that:
- privatekey7_result.public_key == privatekey7_modified_result.public_key
- name: Validate privatekey7 comment on creation
assert:
that:
- privatekey7_result.comment == 'test@privatekey7'
- name: Validate privatekey7 comment update
assert:
that:
- privatekey7_modified_result.comment == 'test_modified@privatekey7'

Loading…
Cancel
Save