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

Add filtering of image attributes #348

Merged
merged 2 commits into from
Oct 16, 2018
Merged
Show file tree
Hide file tree
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 @@ -99,6 +99,8 @@ def self.create_image(ext_management_system, create_options)

def raw_update_image(options)
ext_management_system.with_provider_connection(:service => 'Image') do |service|
image_attrs = service.images.find_by_id(ems_ref).attributes.stringify_keys
options = options.select { |k| image_attrs.key?(k) }
service.images.find_by_id(ems_ref).update(options)
end
rescue => err
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
describe ManageIQ::Providers::Openstack::CloudManager::Template do
let(:ems) { FactoryGirl.create(:ems_openstack) }
let(:image_attributes) { {:name => 'image', :ram => '1'} }
let(:image_attributes) { {'name' => 'test_image', 'description' => 'test_description'} }
let(:template_openstack) { FactoryGirl.create :template_openstack, :ext_management_system => ems, :ems_ref => 'one_id' }
let(:service) { double }

Expand Down Expand Up @@ -46,7 +46,7 @@
subject { template_openstack }

it 'should update image' do
expect(fog_image).to receive(:update).with(image_attributes).once
expect(subject).to receive(:update_image).with(image_attributes).once
subject.update_image(image_attributes)
end
end
Expand Down