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

delete authentication in provider #14307

Merged
merged 3 commits into from
Mar 16, 2017
Merged

delete authentication in provider #14307

merged 3 commits into from
Mar 16, 2017

Conversation

jntullo
Copy link

@jntullo jntullo commented Mar 13, 2017

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

@jntullo jntullo changed the title [WIP] delete authentication in provider delete authentication in provider Mar 14, 2017
@jntullo
Copy link
Author

jntullo commented Mar 14, 2017

@miq-bot remove_label wip

@miq-bot miq-bot removed the wip label Mar 14, 2017
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}"
Copy link
Member

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
Copy link
Member

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 ?

Copy link
Member

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)

Copy link
Author

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}'"
Copy link
Member

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}

Copy link
Member

@abellotti abellotti left a 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
Copy link
Member

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)
Copy link
Member

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)}"

@miq-bot
Copy link
Member

miq-bot commented Mar 16, 2017

Checked commits jntullo/manageiq@aa8e2e9~...88ec961 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
2 files checked, 0 offenses detected
Everything looks good. 👍

@abellotti
Copy link
Member

Thanks @jntullo for the update and Enhancement.

LGTM!! 😍

@abellotti abellotti merged commit ef2219d into ManageIQ:master Mar 16, 2017
@abellotti abellotti added this to the Sprint 57 Ending Mar 27, 2017 milestone Mar 16, 2017
@jntullo jntullo deleted the enhancement/delete_authentication branch November 28, 2017 19:42
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.

3 participants