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

Scheduling catalog items #17594

Merged
merged 4 commits into from
Jun 21, 2018
Merged

Conversation

bdunne
Copy link
Member

@bdunne bdunne commented Jun 15, 2018

Based on: #17588

@bdunne bdunne changed the title Scheduling catalog items [WIP] Scheduling catalog items Jun 15, 2018
@miq-bot miq-bot added the wip label Jun 15, 2018
@bdunne bdunne changed the title [WIP] Scheduling catalog items Scheduling catalog items Jun 15, 2018
@miq-bot miq-bot removed the wip label Jun 15, 2018
@bdunne bdunne force-pushed the scheduling_catalog_items branch 2 times, most recently from 6d625ea to 1faff36 Compare June 15, 2018 20:31
@AllenBW
Copy link
Member

AllenBW commented Jun 19, 2018

Hello void, any chance we can get this in? Its holding up

this: ManageIQ/manageiq-api#400

which is holding up

this: ManageIQ/manageiq-v2v#401

@AllenBW
Copy link
Member

AllenBW commented Jun 19, 2018

This will also need to be backported Gaprindashvili

Copy link
Member

@carbonin carbonin left a comment

Choose a reason for hiding this comment

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

@gtanzillo can you take a look at the concern I have around Rbac here?

I don't have enough info about the bigger picture to know if that's okay or not.

resource = FactoryGirl.create(:host)
schedule = FactoryGirl.create(:miq_schedule, :towhat => resource.class.name, :resource_id => resource, :sched_action => {:method => "test_method", :args => ["abc", 123, :a => 1]})

expect_any_instance_of(Host).to receive("test_method").once.with("abc", 123, :a => 1)
Copy link
Member

Choose a reason for hiding this comment

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

Couldn't we avoid this with something like this:

host = double
expect(Host).to receive(:find).with(resource.id).and_return(host)
expect(host).to receive("test_method").once.with("abc", 123, :a => 1)

@@ -93,6 +93,9 @@ def self.queue_scheduled_work(id, _rufus_job_id, at, _params)

_log.info("Queueing start of schedule id: [#{id}] [#{sched.name}] [#{sched.towhat}] [#{method}]...complete")
msg
elsif sched.resource.respond_to?(method)
sched.resource.send(method, *sched.sched_action[:args])
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't this bypass the RBAC check that is done normally in get_targets? Is that okay?

Copy link
Member

Choose a reason for hiding this comment

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

It's ok because in the other mode (invoke_actions), the targets of the schedule are dynamic and late binding and need to go through RBAC. In this mode, the single target was defined with the schedule and would have gone through RBAC at the time the schedule was created.

raise result[:errors].join(", ") if result[:errors].any?
result[:request]
result = order(user, options, request_options)
result[:request] || raise(result[:errors].join(", "))
Copy link
Member

Choose a reason for hiding this comment

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

Will there never be errors if the :request key has a value? It seems like that case was reversed in priority here.

Previously, this method would raise if there were any errors even if there was a value for the :request key, now if there is a request value the errors will be ignored. Not sure if that change was intentional or not.

Copy link
Member

Choose a reason for hiding this comment

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

Good point @carbonin, this also concerns me.

Copy link
Member

Choose a reason for hiding this comment

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

After a look it does look like the result will only ever have a request if there are no errors, but because this change didn't have anything to do with the intention of the PR I'm going to move it back to the way it was.

@carbonin
Copy link
Member

@AllenBW if this needs to get backported it will need a BZ associated with it. Do you have one?

@AllenBW
Copy link
Member

AllenBW commented Jun 19, 2018

I do NOOOOOOOOOT 😭 @bthurber yah think we can get a bz asking for the scheduling of migrations in the Gaprindashvili branch?

OR

maybe this isn't work we want to see in the g release?

@bthurber
Copy link

@AllenBW this isn't a feature for tech preview but is for GA. The RFE BZ is: https://bugzilla.redhat.com/show_bug.cgi?id=1564255

@carbonin
Copy link
Member

this isn't a feature for tech preview but is for GA

I'm not sure what this means. In the context of ManageIQ this sounds like this shouldn't be backported as the next GA release is Hammer.
If you're referencing some other release timeline we still need the BZ to track backports to the ManageIQ Gaprindashvili branch and that BZ has the flags which indicate it should be backported.

So, put more simply, is this going back to Gaprindashvili or is it just for GA (Hammer only)?

@carbonin
Copy link
Member

@gtanzillo since @bdunne is out for the next 1.5 weeks do you want me to make the changes in my review and push to this PR?

Then I'll assign to you for final review/merge.

@gtanzillo
Copy link
Member

@carbonin

@gtanzillo since @bdunne is out for the next 1.5 weeks do you want me to make the changes in my review and push to this PR?

Then I'll assign to you for final review/merge.

That would be great, was going to ask you if you could do that. Thanks ❤️

@carbonin
Copy link
Member

Okay, @gtanzillo I think this is good for review now.

@miq-bot
Copy link
Member

miq-bot commented Jun 20, 2018

Checked commits bdunne/manageiq@7f692d7~...7a64f16 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
3 files checked, 1 offense detected

app/models/service_template.rb

Copy link
Member

@gtanzillo gtanzillo left a comment

Choose a reason for hiding this comment

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

Looks good! 👍 Thanks @bdunne, @carbonin

@gtanzillo gtanzillo added this to the Sprint 89 Ending Jul 2, 2018 milestone Jun 21, 2018
@gtanzillo gtanzillo merged commit 245ce8b into ManageIQ:master Jun 21, 2018
@bdunne bdunne deleted the scheduling_catalog_items branch July 3, 2018 16:02
@gmcculloug gmcculloug added the v2v label Jul 25, 2018
@simaishi
Copy link
Contributor

@bdunne please add BZ link.

@bdunne
Copy link
Member Author

bdunne commented Jul 25, 2018

@simaishi
Copy link
Contributor

Also, this is based on #17588, and PR 17588 is based on #17581. So they all need to go to Gaprindashvili together?

@bdunne
Copy link
Member Author

bdunne commented Jul 25, 2018

Yes, unfortunately all of these enhancements need to go back for v2v.

@simaishi
Copy link
Contributor

@bdunne The spec file conflicts on backport because of #17641. Can you please create a separate PR for this?

@simaishi
Copy link
Contributor

Backported to Gaprindashvili via #17765

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.

8 participants