From 24e4bae57fafe2f846c06554d4cf4b790466ecba Mon Sep 17 00:00:00 2001 From: Todd Willey Date: Thu, 13 Oct 2011 23:14:34 -0400 Subject: [PATCH] Allow setting userdata as plain ascii or b64. --- lib/fog/openstack/models/compute/server.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/fog/openstack/models/compute/server.rb b/lib/fog/openstack/models/compute/server.rb index 53158298c..e42ad402c 100644 --- a/lib/fog/openstack/models/compute/server.rb +++ b/lib/fog/openstack/models/compute/server.rb @@ -21,6 +21,7 @@ module Fog attribute :accessIPv4 attribute :accessIPv6 attribute :availability_zone + attribute :user_data_encoded attribute :state, :aliases => 'status' attr_reader :password @@ -47,6 +48,10 @@ module Fog metadata.load(metas) end + def user_data=(ascii_userdata) + self.user_data_encoded = [ascii_userdata].pack('m') + end + def destroy requires :id connection.delete_server(id) @@ -155,7 +160,8 @@ module Fog 'personality' => personality, 'accessIPv4' => accessIPv4, 'accessIPv6' => accessIPv6, - 'availability_zone' => availability_zone + 'availability_zone' => availability_zone, + 'user_data' => user_data_encoded } options = options.reject {|key, value| value.nil?} data = connection.create_server(name, image_ref, flavor_ref, options)