Skip to content

Instantly share code, notes, and snippets.

@krames
Last active December 16, 2015 20:29
Show Gist options
  • Select an option

  • Save krames/5492359 to your computer and use it in GitHub Desktop.

Select an option

Save krames/5492359 to your computer and use it in GitHub Desktop.
if Fog::VERSION == "1.10.1"
Fog::Logger.warning "PATCHING Fog::Compute::RackspaceV2::Server to allow networks to be created"
require 'rubygems'
require 'fog'
module Fog
module Compute
class RackspaceV2
class Server < Fog::Compute::Server
def create(options)
requires :name, :image_id, :flavor_id
options[:networks] ||= attributes[:networks]
options[:disk_config] = disk_config unless disk_config.nil?
options[:metadata] = metadata.to_hash unless @metadata.nil?
options[:personality] = personality unless personality.nil?
if options[:networks]
options[:networks].map! { |id| { :uuid => id } }
end
data = service.create_server(name, image_id, flavor_id, 1, 1, options)
merge_attributes(data.body['server'])
true
end
end
end
end
end
else
Fog::Logger.warning "PATCHING Fog::Compute::RackspaceV2::Server - does not apply for #{Fog::VERSION}. Please remove it."
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment