mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
creating via stackscripts with callbacks working
This commit is contained in:
parent
ad5ec1da27
commit
cb2b671c93
3 changed files with 9 additions and 8 deletions
|
@ -11,8 +11,8 @@ module Fog
|
|||
def save
|
||||
requires :server
|
||||
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if identity
|
||||
@type, @image, @stack_script, @script_options, @name, @password, @size =
|
||||
attributes.values_at :type, :image, :stack_script, :script_options, :name, :password, :size
|
||||
@type, @image, @stack_script, @name, @password, @size =
|
||||
attributes.values_at :type, :image, :stack_script, :name, :password, :size
|
||||
create_disk
|
||||
end
|
||||
|
||||
|
@ -51,8 +51,8 @@ module Fog
|
|||
end
|
||||
|
||||
def create_disk_from_stack_script
|
||||
disk = connection.linode_disk_createfromstackscript(server.id, @script.id, @image.id,
|
||||
"#{@name}_main", @size, @password, @script_options)
|
||||
disk = connection.linode_disk_createfromstackscript(server.id, @stack_script.id, @image.id,
|
||||
"#{@name}_main", @size, @password, @stack_script.options)
|
||||
self.id = disk.body['DATA']['DiskID']
|
||||
reload
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ module Fog
|
|||
module Linode
|
||||
class Compute
|
||||
class Server < Fog::Model
|
||||
attr_accessor :stack_script
|
||||
attr_reader :stack_script
|
||||
identity :id
|
||||
attribute :name
|
||||
attribute :status
|
||||
|
@ -47,15 +47,15 @@ module Fog
|
|||
private
|
||||
def create_linode
|
||||
self.id = connection.linode_create(@data_center.id, @flavor.id, @payment_terms).body['DATA']['LinodeID']
|
||||
reload
|
||||
connection.linode_update id, :label => @name
|
||||
ips.create
|
||||
reload
|
||||
end
|
||||
|
||||
def create_disks
|
||||
@swap = disks.create :type => :swap, :name => @name, :size => @flavor.ram
|
||||
@disk = disks.create(:type => @type, :image => @image, :stack_script => @stack_script, :password => @password,
|
||||
:script_options => @script_options, :name => @name, :size => (@flavor.disk*1024)-@flavor.ram)
|
||||
@disk = disks.create(:type => @type, :image => @image, :stack_script => @stack_script,
|
||||
:password => @password, :name => @name, :size => (@flavor.disk*1024)-@flavor.ram)
|
||||
end
|
||||
|
||||
def create_config
|
||||
|
|
|
@ -4,6 +4,7 @@ module Fog
|
|||
module Linode
|
||||
class Compute
|
||||
class StackScript < Fog::Model
|
||||
attr_accessor :options
|
||||
identity :id
|
||||
attribute :name
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue