-
Notifications
You must be signed in to change notification settings - Fork 897
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
Adding scan action with userid to container_image #17264
Conversation
@miq-bot add_label gaprindashvili/yes, bug |
b97e743
to
9e9a32b
Compare
app/models/miq_schedule.rb
Outdated
@@ -192,7 +192,11 @@ def action_vm_scan(obj, _at) | |||
|
|||
def action_scan(obj, _at) | |||
sched_action[:options] ||= {} | |||
obj.scan | |||
if obj.respond_to?(:scan_with_userid) |
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.
does it make sense to encapsulate this If branch
to the scan
method ? ( and thanks to that have here only calling scan
method )
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.
What other objects is this called on? Can we just always pass the userid?
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.
@agrare EmsCluster
also calls scan
without userid
, and without this if
I would break their scan (to be honest I'm not acquainted with this entity at all.)
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.
To be honest we added the new method name and this if
because we were unsure what other types other than ContainerImage support schedulable scan
action, and hoped one of the reviewers could tell us ;-)
"the best way to get the right answer on the internet is not to ask a question; it's to post the wrong answer."
OK, let's see. scan
methods and calls: https://gist.github.com/cben/c582b51e8eb14528fa4ed81243b43a85
Not sure if all these are smart state scans, and if all these are potential targets for MiqSchedule.
OK, indeed seems the only suspect except ContainerImage is EmsCluster:
https://github.com/ManageIQ/manageiq/blob/142129ed/app/models/ems_cluster.rb#L212-L220
Anybody knows what that is (and what's save_drift_state
)?
Can/should we add an optional ignored userid arg to it?
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.
Can/should we add an optional ignored userid arg to it?
Yeah I think so, all of the other scan methods are def scan(userid = "system", options = {})
so this would keep things consistent.
Anybody knows what that is (and what's save_drift_state)?
http://manageiq.org/docs/reference/fine/doc-Managing_Infrastructure_and_Inventory/miq/#detecting-drift-on-clusters
I'm not sure if this can be scheduled but it can be run from the UI.
"the best way to get the right answer on the internet is not to ask a question; it's to post the wrong answer."
LOL that is brilliant
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.
@agrare just to be sure were talking about scan
in container_image.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.
And EmsCluster#scan
3f45458
to
d84be1c
Compare
propagate userid appease linter adding userid param to EmsCluster#scan and ContainerImage#scan appeasing linter
d84be1c
to
af34984
Compare
Checked commit nimrodshn@af34984 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
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.
Looks good.
@miq-bot add_label blocker |
Adding scan action with userid to container_image (cherry picked from commit 959fcd6) https://bugzilla.redhat.com/show_bug.cgi?id=1566529
Gaprindashvili backport details:
|
What this does?
Currently a
ContainerImage
scan that was scheduled is not associated with the currentuserid
. This patch allows the user to schedule aContainerImage
scan associated with the currentuserid
.Why?
Currently scheduled
ContainerImage
scans are failing due to lack of associateduserid
required to create the Job.cc: @cben @agrare @oourfali
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1559459