From: marios <mar...@redhat.com>
Signed-off-by: marios <mar...@redhat.com> --- server/lib/cimi/models/machine.rb | 2 +- server/lib/cimi/models/machine_image.rb | 5 +---- tests/cimi/part5_test.rb | 1 + 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/server/lib/cimi/models/machine.rb b/server/lib/cimi/models/machine.rb index 0e180ce..4a1c42e 100644 --- a/server/lib/cimi/models/machine.rb +++ b/server/lib/cimi/models/machine.rb @@ -133,7 +133,7 @@ class CIMI::Model::Machine < CIMI::Model::Base def self.delete!(id, context) context.driver.destroy_instance(context.credentials, id) - CIMI::Model::Machine.new(:id => id).delete + new(:id => id).destroy end #returns the newly attach machine_volume diff --git a/server/lib/cimi/models/machine_image.rb b/server/lib/cimi/models/machine_image.rb index 247ff72..9b5d335 100644 --- a/server/lib/cimi/models/machine_image.rb +++ b/server/lib/cimi/models/machine_image.rb @@ -57,13 +57,10 @@ class CIMI::Model::MachineImage < CIMI::Model::Base input = XmlSimple.xml_in(request_body.read, {"ForceArray"=>false,"NormaliseSpace"=>2}) raise 'imageLocation attribute is mandatory' unless input['imageLocation'] input['property'] ||= {} - input['property'].kind_of?(Array) ? - input['property'] << { 'image_location' => input['imageLocation'] } : input['property'].merge!('image_location' => input['imageLocation']) else input = JSON.parse(request_body.read) raise 'imageLocation attribute is mandatory' unless input['imageLocation'] input['properties'] ||= [] - input['properties'] << { 'image_location' => input['imageLocation'] } end params = {:id => context.href_id(input["imageLocation"], :machines), :name=>input["name"], :description=>input["description"]} image = context.driver.create_image(context.credentials, params) @@ -77,7 +74,7 @@ class CIMI::Model::MachineImage < CIMI::Model::Base def self.delete!(image_id, context) context.driver.destroy_image(context.credentials, image_id) - CIMI::Model::Image.new(:id => image_id).delete + new(:id => image_id).destroy end end diff --git a/tests/cimi/part5_test.rb b/tests/cimi/part5_test.rb index 8742cbb..566ef26 100644 --- a/tests/cimi/part5_test.rb +++ b/tests/cimi/part5_test.rb @@ -37,6 +37,7 @@ class ManipulateAMachine < CIMI::Test::Spec machine_created = post(machine_add_uri, "<Machine>" + "<name>cimi_machine_part5</name>" + + "<description> created as part of tests/cimi/part5_test </description>" + "<machineTemplate>" + "<machineConfig " + "href=\"" + get_a(cep_json, "machineConfig") + "\"/>" + -- 1.7.11.7