-
Notifications
You must be signed in to change notification settings - Fork 897
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
delete authentication in provider #14307
delete authentication in provider #14307
Conversation
@miq-bot remove_label wip |
task_id = auth.delete_in_provider_queue | ||
action_result(true, "Deleting Authentication with id #{id}", :task_id => task_id) | ||
rescue => err | ||
raise "Could not delete authentication - #{err}" |
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.
Let's also return action_result(false, ...) for rescue case, consistency otherwise our bulk actions won't play nice.
Also, maybe update message to be consistent with others, maybe "Deleting Authentication id:#{id}" see helper methods provider_ident(), vm_ident(), maybe have something similar for authentications.
@@ -1,4 +1,11 @@ | |||
module Api | |||
class AuthenticationsController < BaseController | |||
def delete_resource(type, id, _data = {}) | |||
auth = resource_search(id, type, collection_class(:authentications)) | |||
task_id = auth.delete_in_provider_queue |
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.
Is delete_in_provider_queue always available on Authentication resources ? I only see those defined in manageiq/providers/ansible_tower/shared/automation_manager/*
Should we do a respond_to? first then do the new logic otherwise the current (super) path ?
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.
should we support authentications subcollection delete ?
i.e. DELETE /api/configuration_script_payloads/:id/authentications/:a_id (and bulk equiv)
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.
@abellotti yeah, I wasn't sure if we should support DELETE
. I guess it doesn't make sense because you don't get the task information back. I will remove it from the others as well
private | ||
|
||
def authentication_ident(auth) | ||
"Authentication id:#{auth} name: '#{auth.name}'" |
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 probably meant id:#{auth.id}
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.
looking good, minor changes.
config/api.yml
Outdated
@@ -233,7 +233,7 @@ | |||
:options: | |||
- :collection | |||
- :subcollection | |||
:verbs: *gpd | |||
:verbs: *gp |
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.
Why is the DELETE action removed on resource. You can add that back. We support DELETE on resources that are zapped async, i.e. /api/providers, if user sends a DELETE HTTP action, it's for fire and forget, they won't care about the task_id. If they care, they'd simply use the delete POST action and leverage our action result signature.
@@ -1,4 +1,18 @@ | |||
module Api | |||
class AuthenticationsController < BaseController | |||
def delete_resource(type, id, _data = {}) | |||
auth = resource_search(id, type, collection_class(:authentications)) | |||
raise 'type not currently supported' unless auth.respond_to?(:delete_in_provider_queue) |
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.
Maybe update the message. maybe something like "Delete not supported for #{authentication_ident(auth)}"
Checked commits jntullo/manageiq@aa8e2e9~...88ec961 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
Thanks @jntullo for the update and Enhancement. LGTM!! 😍 |
Update delete of authentications (whoops how'd that get in there) to use
delete_in_provider_queue
in #14305@miq-bot add_label enhancement, api, wip
@miq-bot assign @abellotti