Skip to content

Commit

Permalink
Merge pull request #17783 from mkanoor/remove_ar_object_from_options
Browse files Browse the repository at this point in the history
Options hash should not contain AR objects
  • Loading branch information
gmcculloug authored Jul 31, 2018
2 parents 765f565 + a9746a6 commit b20a725
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions spec/support/quota_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def build_generic_ansible_tower_service_item
end

def build_vmware_service_item
options = {:src_vm_id => @vm_template.id, :requester => @user}.merge(vmware_requested_quota_values)
options = {:src_vm_id => @vm_template.id, :requester_id => @user.id}.merge(vmware_requested_quota_values)
model = {"vmware_service_item" => {:type => 'atomic',
:prov_type => 'vmware',
:request => options}}
Expand All @@ -206,7 +206,7 @@ def build_google_service_item
@small_flavor = FactoryGirl.create(:flavor_google, :ems_id => @ems.id, :cloud_subnet_required => false,
:cpus => 1, :cpu_cores => 1, :memory => 1024)

options = {:src_vm_id => @vm_template.id, :requester => @user}.merge(google_requested_quota_values)
options = {:src_vm_id => @vm_template.id, :requester_id => @user.id}.merge(google_requested_quota_values)
model = {"google_service_item" => {:type => 'atomic',
:prov_type => 'google',
:request => options}}
Expand Down
6 changes: 5 additions & 1 deletion spec/support/service_template_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ def build_service_template_tree(hash)
build_all_composites(hash)
end

def get_user(options)
options[:requester] || User.find(options[:requester_id])
end

def build_all_atomics(hash)
hash.each do |name, value|
next unless value[:type] == "atomic"
Expand All @@ -19,7 +23,7 @@ def build_all_atomics(hash)
options ||= {}
options[:dialog] = {}
mprt = FactoryGirl.create(:miq_provision_request_template,
:requester => options[:requester],
:requester => get_user(options),
:src_vm_id => options[:src_vm_id],
:options => options)
add_st_resource(item, mprt)
Expand Down

0 comments on commit b20a725

Please sign in to comment.