mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[hp|compute] Add the capability to pass in user_data in the server model.
This commit is contained in:
parent
8c72b78e5f
commit
e8e5205e1e
1 changed files with 14 additions and 8 deletions
|
@ -27,6 +27,7 @@ module Fog
|
||||||
attribute :key_name
|
attribute :key_name
|
||||||
attribute :security_groups
|
attribute :security_groups
|
||||||
attribute :config_drive
|
attribute :config_drive
|
||||||
|
attribute :user_data_encoded
|
||||||
# these are implemented as methods
|
# these are implemented as methods
|
||||||
attribute :image_id
|
attribute :image_id
|
||||||
attribute :flavor_id
|
attribute :flavor_id
|
||||||
|
@ -66,6 +67,10 @@ module Fog
|
||||||
metadata.load(metas)
|
metadata.load(metas)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def user_data=(ascii_userdata)
|
||||||
|
self.user_data_encoded = [ascii_userdata].pack('m') # same as Base64.encode64
|
||||||
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
requires :id
|
requires :id
|
||||||
service.delete_server(id)
|
service.delete_server(id)
|
||||||
|
@ -216,15 +221,16 @@ module Fog
|
||||||
meta_hash = {}
|
meta_hash = {}
|
||||||
metadata.each { |meta| meta_hash.store(meta.key, meta.value) }
|
metadata.each { |meta| meta_hash.store(meta.key, meta.value) }
|
||||||
options = {
|
options = {
|
||||||
'metadata' => meta_hash,
|
'metadata' => meta_hash,
|
||||||
'personality' => personality,
|
'personality' => personality,
|
||||||
'accessIPv4' => accessIPv4,
|
'accessIPv4' => accessIPv4,
|
||||||
'accessIPv6' => accessIPv6,
|
'accessIPv6' => accessIPv6,
|
||||||
'min_count' => @min_count,
|
'min_count' => @min_count,
|
||||||
'max_count' => @max_count,
|
'max_count' => @max_count,
|
||||||
'key_name' => key_name,
|
'key_name' => key_name,
|
||||||
'security_groups' => security_groups,
|
'security_groups' => security_groups,
|
||||||
'config_drive' => config_drive
|
'config_drive' => config_drive,
|
||||||
|
'user_data' => user_data_encoded
|
||||||
}
|
}
|
||||||
options = options.reject {|key, value| value.nil?}
|
options = options.reject {|key, value| value.nil?}
|
||||||
# either create a regular server or a persistent server based on input
|
# either create a regular server or a persistent server based on input
|
||||||
|
|
Loading…
Add table
Reference in a new issue