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

Request cancel #421

Merged
merged 8 commits into from
Jul 30, 2018
Merged

Request cancel #421

merged 8 commits into from
Jul 30, 2018

Conversation

bdunne
Copy link
Member

@bdunne bdunne commented Jul 13, 2018

@bzwei
Copy link
Contributor

bzwei commented Jul 13, 2018

@bdunne v2v RFE needs task level cancellation. Do we expect another PR?

@gmcculloug
Copy link
Member

@bdunne Since the back-end is really only supporting this feature for v2v can we reduce the models this is exposed on? At the moment we return "Unsupported" for all other request/task types so I would prefer limiting the action as much as possible.

@bdunne
Copy link
Member Author

bdunne commented Jul 16, 2018

@gmcculloug Many thoughts..

  • I was surprised to find out that we have 4 requests endpoints. Do you know why?
  • I'd like keep these 4 endpoints as similar as possible as long as it makes sense (especially in this case where 2/4 would have to implement it in my opinion)
  • I think an "Unsupported" response is better than "Bad Request Error"
  • It may only be used by v2v at the moment, but I don't think the API should care about implementing things for specific use cases, it should be done in a generic and consistent way.

@gmcculloug
Copy link
Member

I was not involved in building out the API so do not have any insight into why there are 4 endpoints.

@gtanzillo @abellotti Are likely to know the answer.

@JPrause
Copy link
Member

JPrause commented Jul 17, 2018

@miq-bot add_label blocker

@JPrause
Copy link
Member

JPrause commented Jul 17, 2018

@bdunne if this can be backported, can you add the gaprindashvili/yes label

@gtanzillo gtanzillo requested a review from abellotti July 17, 2018 21:08
@bdunne bdunne force-pushed the request_cancel branch 2 times, most recently from d537d04 to c3902ee Compare July 18, 2018 19:03
@gmcculloug
Copy link
Member

@gtanzillo @abellotti Any thoughts on #421 (comment)

@bdunne bdunne changed the title Request cancel [WIP] Request cancel Jul 19, 2018
@miq-bot miq-bot added the wip label Jul 19, 2018
@bdunne bdunne force-pushed the request_cancel branch 2 times, most recently from 8bb22e4 to 5317105 Compare July 19, 2018 15:17
@gtanzillo
Copy link
Member

@gmcculloug Regarding

I was not involved in building out the API so do not have any insight into why there are 4 endpoints.

@gtanzillo @abellotti Any thoughts on #421 (comment)

I was also not involved so I'm not sure either. It seems in some places we've exposed a single endpoint for the base class and in other places we exposed separate endpoints for each subclass like was done here.

Perhaps @abellotti or @Fryguy can comment on that. It would be good to understand which convention we should be following, if there is one.

@bdunne bdunne changed the title [WIP] Request cancel Request cancel Jul 19, 2018
@miq-bot miq-bot removed the wip label Jul 19, 2018
@bdunne
Copy link
Member Author

bdunne commented Jul 19, 2018

Okay, I think this is ready for review. @jrafanie can you put another set of 👀 on the tests?

@jrafanie
Copy link
Member

LGTM. It's a bit hard to follow at first with the indirection but the alternative is 1000 lines of duplicated tests, so :shipit:

It would be good if @Fryguy can comment on the separate collections for each subclass. It seems strange. I can't imagine having separate collections for vmware vms, redhat vms, etc. On the fipside, these things are not the same and are actual tasks for completely different end user features. 🤷‍♂️

@@ -0,0 +1,14 @@
module Api
module Mixins
module ResourceCancel
Copy link
Member

@Fryguy Fryguy Jul 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be ResourceCancel or TaskCancel?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's for ServiceOrder, MiqRequestX4 or MiqRequestTask primary collections.

@Fryguy
Copy link
Member

Fryguy commented Jul 19, 2018

It would be good if @Fryguy can comment on the separate collections for each subclass. It seems strange. I can't imagine having separate collections for vmware vms, redhat vms, etc.

@jrafanie Where are you seeing this?

@@ -224,6 +224,12 @@ def expect_options_results(type, data = {})
expect(response.headers['Access-Control-Allow-Methods']).to include('OPTIONS')
end

def expect_unauthorized_request
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor, but this might read better as expect_forbidden_request, since the status is :forbidden

@bdunne
Copy link
Member Author

bdunne commented Jul 19, 2018

@jrafanie Where are you seeing this?

/api/requests
/api/automation_requests
/api/service_requests
/api/provision_requests

Talking to Alberto, it sounds like it just grew this way over time. Hopefully we don't need to create new endpoints for the other 12 subclasses of MiqRequest.

@miq-bot
Copy link
Member

miq-bot commented Jul 25, 2018

Checked commits bdunne/manageiq-api@7cad510~...1064cf9 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
19 files checked, 9 offenses detected

app/controllers/api/mixins/resource_cancel.rb

app/controllers/api/subcollections/request_tasks.rb

app/controllers/api/subcollections/service_requests.rb

spec/requests/automation_requests_spec.rb

spec/requests/provision_requests_spec.rb

spec/requests/requests_spec.rb

spec/requests/service_orders_spec.rb

spec/requests/service_requests_spec.rb

spec/requests/service_templates_spec.rb

@AparnaKarve
Copy link
Contributor

Can we get this merged today?

@bthurber
Copy link

@gtanzillo @gmcculloug @blomquisg we will need this merged ASAP for 5.9.4-2 build for tomorrow. Anything here left to finish/review?

@bthurber
Copy link

@bdunne can you respond to @Fryguy last comment? We also need to add enhancement, transformation and grapendashvili/yes labels so this get's pulled into the next build once merged.

@bdunne
Copy link
Member Author

bdunne commented Jul 30, 2018

@bthurber I responded in: #421 (comment)

@bdunne
Copy link
Member Author

bdunne commented Jul 30, 2018

@miq-bot add_labels gaprindashvili/yes enhancement transformation

@miq-bot
Copy link
Member

miq-bot commented Jul 30, 2018

@bdunne Cannot apply the following label because they are not recognized: gaprindashvili/yes enhancement transformation

@bdunne
Copy link
Member Author

bdunne commented Jul 30, 2018

@miq-bot add_labels gaprindashvili/yes
@miq-bot add_labels enhancement
@miq-bot add_labels transformation

@gtanzillo gtanzillo added this to the Sprint 91 Ending Jul 30, 2018 milestone Jul 30, 2018
@gtanzillo gtanzillo merged commit 62de390 into ManageIQ:master Jul 30, 2018
@bdunne bdunne deleted the request_cancel branch July 30, 2018 22:02
simaishi pushed a commit that referenced this pull request Jul 31, 2018
@simaishi
Copy link
Contributor

Gaprindashvili backport details:

$ git log -1
commit b7047744b21596fafe4cbfdc1064cad1fd8ba76c
Author: Gregg Tanzillo <gtanzill@redhat.com>
Date:   Mon Jul 30 18:02:12 2018 -0400

    Merge pull request #421 from bdunne/request_cancel
    
    Request cancel
    (cherry picked from commit 62de390490c8bc333f27feedfc58455ced1e7483)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1610533

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.