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.
This commit is contained in:
parent
8da48b1a40
commit
dda80c46e9
3 changed files with 18 additions and 0 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- openssh_keypair - add key ``comment`` to return value
|
|
@ -113,6 +113,11 @@ public_key:
|
||||||
returned: changed or success
|
returned: changed or success
|
||||||
type: str
|
type: str
|
||||||
sample: ssh-rsa AAAAB3Nza(...omitted...)veL4E3Xcw== test_key
|
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
|
import os
|
||||||
|
@ -313,6 +318,7 @@ class Keypair(object):
|
||||||
# On removal this has no value
|
# On removal this has no value
|
||||||
'fingerprint': self.fingerprint[1] if self.fingerprint else '',
|
'fingerprint': self.fingerprint[1] if self.fingerprint else '',
|
||||||
'public_key': self.public_key,
|
'public_key': self.public_key,
|
||||||
|
'comment': self.comment if self.comment else '',
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
|
@ -97,3 +97,13 @@
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- privatekey7_result.public_key == privatekey7_modified_result.public_key
|
- 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…
Reference in a new issue