1
0
Fork 0
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:
Eric Johnson 2014-04-02 22:05:07 +00:00
parent 3834726134
commit 7161fd0311
2 changed files with 20 additions and 1 deletions

View file

@ -20,6 +20,8 @@ module Fog
attribute :service_accounts, :aliases => 'serviceAccounts' attribute :service_accounts, :aliases => 'serviceAccounts'
attribute :tags, :squash => 'items' attribute :tags, :squash => 'items'
attribute :self_link, :aliases => 'selfLink' attribute :self_link, :aliases => 'selfLink'
attribute :auto_restart
attribute :on_host_maintenance
def image_name=(args) def image_name=(args)
Fog::Logger.deprecation("image_name= is no longer used [light_black](#{caller.first})[/]") Fog::Logger.deprecation("image_name= is no longer used [light_black](#{caller.first})[/]")
@ -153,7 +155,9 @@ module Fog
'disks' => disks, 'disks' => disks,
'metadata' => metadata, 'metadata' => metadata,
'serviceAccounts' => service_accounts, 'serviceAccounts' => service_accounts,
'tags' => tags 'tags' => tags,
'auto_restart' => auto_restart,
'on_host_maintenance' => on_host_maintenance
}.delete_if {|key, value| value.nil?} }.delete_if {|key, value| value.nil?}
if service_accounts if service_accounts

View file

@ -151,6 +151,21 @@ module Fog
networkInterfaces << networkInterface networkInterfaces << networkInterface
end 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 # TODO: add other networks
body_object['networkInterfaces'] = networkInterfaces body_object['networkInterfaces'] = networkInterfaces