-
Notifications
You must be signed in to change notification settings - Fork 898
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
Scheduling catalog items #17594
Conversation
6821a01
to
e55964e
Compare
6d625ea
to
1faff36
Compare
Hello void, any chance we can get this in? Its holding up this: ManageIQ/manageiq-api#400 which is holding up |
This will also need to be backported Gaprindashvili |
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.
@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.
spec/models/miq_schedule_spec.rb
Outdated
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) |
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.
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)
app/models/miq_schedule.rb
Outdated
@@ -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]) |
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.
Doesn't this bypass the RBAC check that is done normally in get_targets
? Is that okay?
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.
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.
app/models/service_template.rb
Outdated
raise result[:errors].join(", ") if result[:errors].any? | ||
result[:request] | ||
result = order(user, options, request_options) | ||
result[:request] || raise(result[:errors].join(", ")) |
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.
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.
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.
Good point @carbonin, this also concerns me.
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.
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.
@AllenBW if this needs to get backported it will need a BZ associated with it. Do you have one? |
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? |
@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 |
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. So, put more simply, is this going back to Gaprindashvili or is it just for GA (Hammer only)? |
@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 ❤️ |
The inner variable was shadowing the outer one, `hash` was poorly named and the setup can be moved into one `before` block.
1faff36
to
7a64f16
Compare
Okay, @gtanzillo I think this is good for review now. |
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 app/models/service_template.rb
|
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.
@bdunne please add BZ link. |
Yes, unfortunately all of these enhancements need to go back for v2v. |
Backported to Gaprindashvili via #17765 |
Based on: #17588