mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[rackspace] Fixes issue #2187 Compute.servers.bootstrap mutates the :networks option
Server.create modified the options it got. Most modifications were reusable in succeeding invocations but mapping the :network ids to json was not. It is safer to use a copy for all the values anyway
This commit is contained in:
parent
dcffbc7584
commit
0d5ad6c05b
1 changed files with 9 additions and 8 deletions
|
@ -198,17 +198,18 @@ module Fog
|
|||
# * BUILD -> ERROR (on error)
|
||||
def create(options)
|
||||
requires :name, :image_id, :flavor_id
|
||||
modified_options = Marshal.load(Marshal.dump(options))
|
||||
|
||||
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?
|
||||
options[:keypair] ||= attributes[:keypair]
|
||||
modified_options[:networks] ||= attributes[:networks]
|
||||
modified_options[:disk_config] = disk_config unless disk_config.nil?
|
||||
modified_options[:metadata] = metadata.to_hash unless @metadata.nil?
|
||||
modified_options[:personality] = personality unless personality.nil?
|
||||
modified_options[:keypair] ||= attributes[:keypair]
|
||||
|
||||
if options[:networks]
|
||||
options[:networks].map! { |id| { :uuid => id } }
|
||||
if modified_options[:networks]
|
||||
modified_options[:networks].map! { |id| { :uuid => id } }
|
||||
end
|
||||
data = service.create_server(name, image_id, flavor_id, 1, 1, options)
|
||||
data = service.create_server(name, image_id, flavor_id, 1, 1, modified_options)
|
||||
merge_attributes(data.body['server'])
|
||||
true
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue