-
Notifications
You must be signed in to change notification settings - Fork 356
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
Editing username for EmbeddedAnsible
SCM credential cause key to be nil'd out
#7286
Comments
I will do a quick look into this to see if I can fix it on my own, but it is something we stumbled on while troubleshooting this ticket with a customer: https://bugzilla.redhat.com/show_bug.cgi?id=1869885 Could be frontend or backend code that is the culprit, but not sure yet. |
Did a bit of Debugging locally, and rails log seems suggest the UI calls a API action for this and that queues a backend task: Log output
Unless it is sending bad data to said task, I think this is most likely NOT a UI problem, but I will keep the issue open here until I know for sure (and ultimately will not open an issue elsewhere just to avoid this issue being tracked across multiple issues). |
Okay, the issue is in Core. The following change fixes is for diff --git a/app/models/manageiq/providers/embedded_ansible/automation_manager/scm_credential.rb b/app/models/manageiq/providers/embedded_ansible/automation_manager/scm_credential.rb
index 9dc2f5ca0e..7e0b88bef3 100644
--- a/app/models/manageiq/providers/embedded_ansible/automation_manager/scm_credential.rb
+++ b/app/models/manageiq/providers/embedded_ansible/automation_manager/scm_credential.rb
@@ -49,8 +49,8 @@ class ManageIQ::Providers::EmbeddedAnsible::AutomationManager::ScmCredential < M
def self.params_to_attributes(params)
attrs = params.dup
- attrs[:auth_key] = attrs.delete(:ssh_key_data)
- attrs[:auth_key_password] = attrs.delete(:ssh_key_unlock)
+ attrs[:auth_key] = attrs.delete(:ssh_key_data) if attrs.key?(:ssh_key_data)
+ attrs[:auth_key_password] = attrs.delete(:ssh_key_unlock) if attrs.key?(:ssh_key_unlock)
attrs
end But there will need to be probably changes to all credential types. I will work on a PR for this tomorrow. |
Yeah, since we don't return the auth_key and auth_key_password for security reasons then the UI is presenting nothing. After that the form sends back nil and we write it. @NickLaMuro Does the above patch work all the way from the UI? I would have expected the UI form to send the key with a literal null value. Not sure what the right answer is here... I would assume we should follow the same pattern as we do for any other password field that is part of form (like with provider credentials, for example) |
If you look at the log output from this #7286 (comment) you will see it just include |
Fixed via ManageIQ/manageiq#20494 Closing... |
Woops, not fixed via that PR, but this one: Which is still open. Reopening... |
Steps to reproduce
Enable
EmbeddedAnsible
(if it is not already)Go to
Automation -> Ansible -> Credentials
Add a new SCM key, with a username (example: "git") and private key (example: "totally fake")
In a Rails console, check the credentials is there and the username and key exist:
Edit the new credential, and change only the userid (example: "got")
Observe the change in the
:auth_key
in the Rails console:The text was updated successfully, but these errors were encountered: