mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[google|compute] adding automaticRestart and onHostMaintenance
This commit is contained in:
parent
3834726134
commit
7161fd0311
2 changed files with 20 additions and 1 deletions
|
@ -20,6 +20,8 @@ module Fog
|
|||
attribute :service_accounts, :aliases => 'serviceAccounts'
|
||||
attribute :tags, :squash => 'items'
|
||||
attribute :self_link, :aliases => 'selfLink'
|
||||
attribute :auto_restart
|
||||
attribute :on_host_maintenance
|
||||
|
||||
def image_name=(args)
|
||||
Fog::Logger.deprecation("image_name= is no longer used [light_black](#{caller.first})[/]")
|
||||
|
@ -153,7 +155,9 @@ module Fog
|
|||
'disks' => disks,
|
||||
'metadata' => metadata,
|
||||
'serviceAccounts' => service_accounts,
|
||||
'tags' => tags
|
||||
'tags' => tags,
|
||||
'auto_restart' => auto_restart,
|
||||
'on_host_maintenance' => on_host_maintenance
|
||||
}.delete_if {|key, value| value.nil?}
|
||||
|
||||
if service_accounts
|
||||
|
|
|
@ -151,6 +151,21 @@ module Fog
|
|||
networkInterfaces << networkInterface
|
||||
end
|
||||
|
||||
scheduling = {
|
||||
'automaticRestart' => false,
|
||||
'onHostMaintenance' => "MIGRATE"
|
||||
}
|
||||
if options.has_key? 'auto_restart'
|
||||
scheduling['automaticRestart'] = options.delete 'auto_restart'
|
||||
scheduling['automaticRestart'] = scheduling['automaticRestart'].class == TrueClass
|
||||
end
|
||||
if options.has_key? 'on_host_maintenance'
|
||||
ohm = options.delete 'on_host_maintenance'
|
||||
scheduling['onHostMaintenance'] = (ohm.respond_to?("upcase") &&
|
||||
ohm.upcase == "MIGRATE" && "MIGRATE") || "TERMINATE"
|
||||
end
|
||||
body_object['scheduling'] = scheduling
|
||||
|
||||
# TODO: add other networks
|
||||
body_object['networkInterfaces'] = networkInterfaces
|
||||
|
||||
|
|
Loading…
Reference in a new issue