From 98eb4f683586b0c637ea798adda5ed05e6fcce65 Mon Sep 17 00:00:00 2001 From: Ohad Levy Date: Thu, 13 Sep 2012 09:28:19 +0300 Subject: [PATCH] [Openstack|Compute] Security Groups are not assigned correctly to servers --- lib/fog/openstack/requests/compute/create_server.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/fog/openstack/requests/compute/create_server.rb b/lib/fog/openstack/requests/compute/create_server.rb index b1bc4620a..a14d4e0d5 100644 --- a/lib/fog/openstack/requests/compute/create_server.rb +++ b/lib/fog/openstack/requests/compute/create_server.rb @@ -13,12 +13,18 @@ module Fog } vanilla_options = ['metadata', 'accessIPv4', 'accessIPv6', - 'availability_zone', 'user_data', 'key_name', - 'security_groups', 'adminPass'] + 'availability_zone', 'user_data', 'key_name', 'adminPass'] vanilla_options.select{|o| options[o]}.each do |key| data['server'][key] = options[key] end + if options['security_groups'] + # security names requires a hash with a name prefix + data['server']['security_groups'] = [options['security_groups']].flatten.map do |sg| + { :name => sg.is_a?(Fog::Compute::OpenStack::SecurityGroup) ? sg.name : sg } + end + end + if options['personality'] data['server']['personality'] = [] for file in options['personality']