-
Notifications
You must be signed in to change notification settings - Fork 143
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
Set user when queueing VM actions #326
Conversation
The code climate issues mentioned are not something that should be addressed here |
@@ -477,5 +478,18 @@ def request_console_vm(vm, protocol) | |||
rescue => err | |||
action_result(false, err.to_s) | |||
end | |||
|
|||
def queue_options(method) | |||
current_user = User.current_user |
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.
Does current user always exists for API requests?
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.
yes, we set that based on the authentication (basic auth/auth/system).
@jntullo These changes don't cover VM retirement. |
action_result(true, desc, :task_id => task_id) | ||
rescue => err | ||
action_result(false, err.to_s) | ||
end | ||
|
||
def destroy_vm(vm) | ||
desc = "#{vm_ident(vm)} deleting" | ||
task_id = queue_object_action(vm, desc, :method_name => "destroy") |
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.
hmm, was the :role missing here by mistake ? we're now introducing it with queue_options.
don't we need the same done for the instances controller actions ? |
@lfu currently retirement is not queuing an action, but instead calling this method...does this still need the user? It does not seem like it would be used |
When VM actions are queued, the user should be set so that it is available as the requester in automate. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1546375
@jntullo I made a PR ManageIQ/manageiq#17033 to fix the retirement issue. |
@abellotti added it for instance actions as well |
Checked commits jntullo/manageiq-api@8284f6d~...937ae6a with ruby 2.3.3, rubocop 0.52.0, haml-lint 0.20.0, and yamllint 1.10.0 |
It works good, even for retirement with these 2 PRs. |
Thanks @jntullo for fixing this. LGTM!! 👍 |
Fine backport (to manageiq repo) details:
|
This PR can't go to Fine branch as is, and caused Travis failures... after talking with @abellotti, reverted the backport.
|
Set user when queueing VM actions (cherry picked from commit c6e8b4f) Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1565259
Gaprindashvili backport details:
|
When VM actions are queued, the user should be set so that it is available as the requester in automate.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1546375
Please review @lfu