Sha256: c954f8782efdac5ce2071772b674627779c1f5a9ecf2a0dc2bda10893bb1254d
Contents?: true
Size: 1.46 KB
Versions: 40
Compression:
Stored size: 1.46 KB
Contents
module Fog module Compute class OpenStack class Real def create_image(server_id, name, metadata={}) body = { 'createImage' => { 'name' => name, 'metadata' => metadata }} data = server_action(server_id, body) image_id = data.headers["Location"].scan(/.*\/(.*)/).flatten[0] get_image_details(image_id) end end class Mock def create_image(server_id, name, metadata={}) response = Excon::Response.new response.status = 202 img_id=Fog::Mock.random_numbers(6).to_s data = { 'id' => img_id, 'server' => {"id"=>"3", "links"=>[{"href"=>"http://nova1:8774/admin/servers/#{server_id}", "rel"=>"bookmark"}]}, 'links' => [{"href"=>"http://nova1:8774/v1.1/admin/images/#{img_id}", "rel"=>"self"}, {"href"=>"http://nova1:8774/admin/images/#{img_id}", "rel"=>"bookmark"}], 'metadata' => metadata || {}, 'name' => name || "server_#{rand(999)}", 'progress' => 0, 'status' => 'SAVING', 'minDisk' => 0, 'minRam' => 0, 'updated' => "", 'created' => "" } self.data[:last_modified][:images][data['id']] = Time.now self.data[:images][data['id']] = data response.body = { 'image' => data } response end end end end end
Version data entries
40 entries across 40 versions & 5 rubygems