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 :security_groups
|
||||
attribute :config_drive
|
||||
attribute :user_data_encoded
|
||||
# these are implemented as methods
|
||||
attribute :image_id
|
||||
attribute :flavor_id
|
||||
|
@ -66,6 +67,10 @@ module Fog
|
|||
metadata.load(metas)
|
||||
end
|
||||
|
||||
def user_data=(ascii_userdata)
|
||||
self.user_data_encoded = [ascii_userdata].pack('m') # same as Base64.encode64
|
||||
end
|
||||
|
||||
def destroy
|
||||
requires :id
|
||||
service.delete_server(id)
|
||||
|
@ -216,15 +221,16 @@ module Fog
|
|||
meta_hash = {}
|
||||
metadata.each { |meta| meta_hash.store(meta.key, meta.value) }
|
||||
options = {
|
||||
'metadata' => meta_hash,
|
||||
'personality' => personality,
|
||||
'accessIPv4' => accessIPv4,
|
||||
'accessIPv6' => accessIPv6,
|
||||
'min_count' => @min_count,
|
||||
'max_count' => @max_count,
|
||||
'key_name' => key_name,
|
||||
'metadata' => meta_hash,
|
||||
'personality' => personality,
|
||||
'accessIPv4' => accessIPv4,
|
||||
'accessIPv6' => accessIPv6,
|
||||
'min_count' => @min_count,
|
||||
'max_count' => @max_count,
|
||||
'key_name' => key_name,
|
||||
'security_groups' => security_groups,
|
||||
'config_drive' => config_drive
|
||||
'config_drive' => config_drive,
|
||||
'user_data' => user_data_encoded
|
||||
}
|
||||
options = options.reject {|key, value| value.nil?}
|
||||
# either create a regular server or a persistent server based on input
|
||||
|
|
Loading…
Add table
Reference in a new issue