Skip to content

Commit

Permalink
Merge pull request #348 from andyvesel/image_attrs_filtering
Browse files Browse the repository at this point in the history
Add filtering of image attributes
  • Loading branch information
mansam authored Oct 16, 2018
2 parents 85ec442 + 1b7fc7f commit a5fa4a2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
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

0 comments on commit a5fa4a2

Please sign in to comment.