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

Do not pass the same argument twice #14158

Merged
merged 1 commit into from
Mar 6, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def default_authentication_type
end

def scan_job_create(entity)
check_policy_prevent(:request_containerimage_scan, entity, :raw_scan_job_create, entity)
check_policy_prevent(:request_containerimage_scan, entity, :raw_scan_job_create)
end

def raw_scan_job_create(entity)
Expand All @@ -169,12 +169,12 @@ def raw_scan_job_create(entity)
# policy_event: the event sent to automate for policy resolution
# cb_method: the MiqQueue callback method along with the parameters that is called
# when automate process is done and the event is not prevented to proceed by policy
def check_policy_prevent(policy_event, event_target, *cb_method)
def check_policy_prevent(policy_event, event_target, cb_method)
cb = {
:class_name => self.class.to_s,
:instance_id => id,
:method_name => :check_policy_prevent_callback,
:args => [*cb_method],
:args => [cb_method, event_target],
Copy link
Member

Choose a reason for hiding this comment

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

@moolitayer I'm assuming that event_target is an object (which is good)

But this is also putting the object into the queue. (which is bad)

Please change the :args to have the class and id.
And please change check_policy_prevent_callback to take arguments with a class and id.

Copy link
Member

Choose a reason for hiding this comment

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

ok, this is being fixed in another pr

:server_guid => MiqServer.my_guid
}
enforce_policy(event_target, policy_event, {}, { :miq_callback => cb }) unless policy_event.nil?
Expand Down