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

[EmbeddedAnsible] Ensure newline for auth_key in MachineCredential #20845

Merged

Conversation

NickLaMuro
Copy link
Member

Followup to #20771

Original Description

SSH formats like OPENSSH require that a newline exist on the last line, otherwise it is considered an invalid format.

This adds a before_save before_validation callback to the model to ensure that it adds a newline to the key in case it was stripped off by the UI or via other means.

Links

Makes `.ensure_newline_for_ssh_key` a shared method from the base class
so other classes can make use of it.
@NickLaMuro NickLaMuro force-pushed the embedded_ansible_machine_credential_newline branch from d00d810 to 3bcc188 Compare December 1, 2020 15:57
@miq-bot
Copy link
Member

miq-bot commented Dec 1, 2020

Checked commits NickLaMuro/manageiq@cf27ae6~...3bcc188 with ruby 2.6.3, rubocop 0.82.0, haml-lint 0.35.0, and yamllint
5 files checked, 0 offenses detected
Everything looks fine. 👍

@tinaafitz
Copy link
Member

@miq-bot add_label ivanchuk/yes

@simaishi
Copy link
Contributor

simaishi commented Dec 1, 2020

@kbrock @Fryguy please review

@Fryguy Fryguy self-assigned this Dec 1, 2020
@Fryguy Fryguy added the bug label Dec 1, 2020
@Fryguy Fryguy merged commit 3dad919 into ManageIQ:master Dec 1, 2020
simaishi pushed a commit that referenced this pull request Dec 1, 2020
…edential_newline

[EmbeddedAnsible] Ensure newline for auth_key in MachineCredential

(cherry picked from commit 3dad919)

https://bugzilla.redhat.com/show_bug.cgi?id=1893014
@simaishi
Copy link
Contributor

simaishi commented Dec 1, 2020

Ivanchuk backport details:

$ git log -1
commit a4a3403be1e59789f2c0febb5d8af0c2f1175e0d
Author: Jason Frey <fryguy9@gmail.com>
Date:   Tue Dec 1 12:09:36 2020 -0500

    Merge pull request #20845 from NickLaMuro/embedded_ansible_machine_credential_newline

    [EmbeddedAnsible] Ensure newline for auth_key in MachineCredential

    (cherry picked from commit 3dad9196d0099e0f263e145404ee13319b325a6f)

    https://bugzilla.redhat.com/show_bug.cgi?id=1893014

simaishi pushed a commit that referenced this pull request Dec 1, 2020
…edential_newline

[EmbeddedAnsible] Ensure newline for auth_key in MachineCredential

(cherry picked from commit 3dad919)
simaishi pushed a commit that referenced this pull request Dec 1, 2020
…edential_newline

[EmbeddedAnsible] Ensure newline for auth_key in MachineCredential

(cherry picked from commit 3dad919)
@simaishi
Copy link
Contributor

simaishi commented Dec 1, 2020

Jansa backport details:

$ git log -1
commit 22d30a31cfbf08cc3fa10fde2802bc4f02314c8b
Author: Jason Frey <fryguy9@gmail.com>
Date:   Tue Dec 1 12:09:36 2020 -0500

    Merge pull request #20845 from NickLaMuro/embedded_ansible_machine_credential_newline

    [EmbeddedAnsible] Ensure newline for auth_key in MachineCredential

    (cherry picked from commit 3dad9196d0099e0f263e145404ee13319b325a6f)

@simaishi
Copy link
Contributor

simaishi commented Dec 1, 2020

Kasparov backport details:

$ git log -1
commit e6fd4cdcf2ca2b607c89216c48c68a258c33dcaf
Author: Jason Frey <fryguy9@gmail.com>
Date:   Tue Dec 1 12:09:36 2020 -0500

    Merge pull request #20845 from NickLaMuro/embedded_ansible_machine_credential_newline

    [EmbeddedAnsible] Ensure newline for auth_key in MachineCredential

    (cherry picked from commit 3dad9196d0099e0f263e145404ee13319b325a6f)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants