-
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
Add resource relation to MiqSchedule #17581
Conversation
5774966
to
9247829
Compare
app/models/miq_schedule.rb
Outdated
|
||
_log.info("Queueing start of schedule id: [#{id}] [#{sched.name}] [#{sched.towhat}] [#{method}]...complete") | ||
msg | ||
else | ||
_log.warn("[#{sched.name}] no such action: [#{method}], aborting schedule") | ||
return |
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.
This return is redundant now, right?
app/models/miq_schedule.rb
Outdated
@@ -39,6 +42,11 @@ class MiqSchedule < ApplicationRecord | |||
default_value_for :enabled, true | |||
default_value_for(:zone_id) { MiqServer.my_server.zone_id } | |||
|
|||
def resource | |||
# HACK: this should be a real relation, but for now it's using a reserve_attribute for backport reasons | |||
Object.const_get(towhat).find_by(:id => resource_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.
Are we deprecating towhat
here? The commit says we are but maybe it's coming in a future PR?
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.
9247829
to
01d3580
Compare
01d3580
to
4c3a53f
Compare
@jrafanie Thanks, I cleaned up the |
Checked commits bdunne/manageiq@e6991fd~...4c3a53f with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
def resource | ||
# HACK: this should be a real relation, but for now it's using a reserve_attribute for backport reasons | ||
return unless resource_id | ||
towhat.safe_constantize.find_by(:id => resource_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.
I can't unsee 'tow hat' now, thanks @bdunne
LGTM, I'll give others a little bit to verify the reserves usage since I haven't seen or used it in a while. |
Add resource relation to MiqSchedule (cherry picked from commit 381f94a)
Gaprindashvili backport details:
|
Followups: