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
Add comment parameter to openssl_publickey #56149
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First of all, how should this look like for PEM (OpenSSL) keys?
Then:
- Idempotency checks are missing.
- You should add integration tests for this.
- You should add some validations, like disallowing
\n
in comments for OpenSSH keys. Also, what should be returned in absence of comments? Currently you're returningundefined
.
description: | ||
- A comment to append to the public key | ||
type: str | ||
version_added: "2.8" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version_added: "2.8" | |
version_added: "2.9" |
No new features are accepted for Ansible 2.8.
@@ -288,6 +299,9 @@ def dump(self): | |||
if self.backup_file: | |||
result['backup_file'] = self.backup_file | |||
|
|||
if self.pubkey_comment: | |||
result['comment'] = self.pubkey_comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to document this in return values if you return it.
@@ -214,6 +221,10 @@ def generate(self, module): | |||
|
|||
if self.backup: | |||
self.backup_file = module.backup_local(self.path) | |||
|
|||
if self.pubkey_comment is not None: | |||
publickey_content = publickey_content + (" " + self.pubkey_comment).encode('utf-8') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this only makes sense for OpenSSH keys. For OpenSSL PEM keys, you don't want to append text in the same line directly after ----- END PUBLIC KEY -----
.
bot_status |
The test
|
Componentslib/ansible/modules/crypto/openssl_publickey.py Metadatawaiting_on: tterranigma |
@nkakouros are you still around? |
@felixfontein Yes, but I am really swamped right now.. I would like to address the issues but I don't see this happening before September. |
No problem! Just a little warning: if this isn't merged before 2.9's Feature Freeze (currently scheduled for August 29th), it will have to wait for Ansible 2.10. |
Thank you very much for your interest in Ansible. Ansible has migrated much of the content into separate repositories to allow for more rapid, independent development. We are closing this issue/PR because this content has been moved to one or more collection repositories.
For further information, please see: |
SUMMARY
This adds a new parameter to the
openssl_publickey
module that allows the user to have a comment at the end of the public key, similar to the-C
option ofssh-keygen
.ISSUE TYPE
COMPONENT NAME
openssl_publickey