Skip to content

Commit

Permalink
Merge pull request #13031 from mkanoor/bugzilla_1401247
Browse files Browse the repository at this point in the history
When importing domains from the UI pass in the tenant_id
(cherry picked from commit 2db6555)

https://bugzilla.redhat.com/show_bug.cgi?id=1404669
  • Loading branch information
gmcculloug authored and simaishi committed Jan 9, 2017
1 parent 6ed7a26 commit 1fa106d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/services/automate_import_service.rb
Expand Up @@ -14,7 +14,8 @@ def import_datastore(import_file_upload,
import_options = {
"import_as" => domain_name_to_import_to.presence || domain_name_to_import_from,
"overwrite" => true,
"zip_file" => "automate_temporary_zip.zip"
"zip_file" => "automate_temporary_zip.zip",
"tenant_id" => User.current_user.current_tenant.id
}
ae_import = MiqAeImport.new(domain_name_to_import_from, import_options)

Expand Down
8 changes: 6 additions & 2 deletions spec/services/automate_import_service_spec.rb
Expand Up @@ -32,12 +32,15 @@
let(:miq_ae_import) { double("MiqAeYamlImportZipfs", :import_stats => "import stats") }
let(:removable_entry) { double(:name => "carrot/something_else/namespace.yaml") }
let(:removable_class_entry) { double(:name => "carrot/something_else.class/class.yaml") }
let(:user) { FactoryGirl.create(:user_with_group) }

before do
User.current_user = user
import_options = {
"import_as" => "potato",
"overwrite" => true,
"zip_file" => "automate_temporary_zip.zip"
"zip_file" => "automate_temporary_zip.zip",
"tenant_id" => user.current_tenant.id
}
allow(MiqAeImport).to receive(:new).with("carrot", import_options).and_return(miq_ae_import)
allow(miq_ae_import).to receive(:remove_unrelated_entries)
Expand Down Expand Up @@ -91,7 +94,8 @@
"carrot",
"import_as" => "carrot",
"overwrite" => true,
"zip_file" => "automate_temporary_zip.zip"
"zip_file" => "automate_temporary_zip.zip",
"tenant_id" => user.current_tenant.id
).and_return(miq_ae_import)
automate_import_service.import_datastore(import_file_upload, "carrot", "", ["starch"])
end
Expand Down

0 comments on commit 1fa106d

Please sign in to comment.