1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[google|compute] disk model: Add auto_delete option to get_as_boot_disk

This commit is contained in:
kbockmanrs 2014-03-06 19:01:02 +00:00
parent 799e59a760
commit 0065c8ba6b

View file

@ -57,9 +57,12 @@ module Fog
end
end
def get_object(writable=true, boot=false, device_name=nil)
# auto_delete can only be applied to disks created before instance creation.
# auto_delete = true will automatically delete disk upon instance termination.
def get_object(writable=true, boot=false, device_name=nil, auto_delete=nil)
mode = writable ? 'READ_WRITE' : 'READ_ONLY'
value = {
'autoDelete' => auto_delete,
'boot' => boot,
'source' => self_link,
'mode' => mode,
@ -69,8 +72,8 @@ module Fog
return Hash[value]
end
def get_as_boot_disk(writable=true)
get_object(writable, true)
def get_as_boot_disk(writable=true, auto_delete=false)
get_object(writable, true, nil, auto_delete)
end
def ready?