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

Merge pull request #2378 from maestrodev/google-tags

[google|compute] Add support for instance tags
This commit is contained in:
Nat Welch 2013-11-08 14:46:02 -08:00
commit d2d6ccf116
3 changed files with 6 additions and 1 deletions

View file

@ -9,6 +9,7 @@ def test
:private_key_path => File.expand_path("~/.ssh/id_rsa"), :private_key_path => File.expand_path("~/.ssh/id_rsa"),
:public_key_path => File.expand_path("~/.ssh/id_rsa.pub"), :public_key_path => File.expand_path("~/.ssh/id_rsa.pub"),
:user => ENV['USER'], :user => ENV['USER'],
:tags => ["fog"]
}) })
# My own wait_for because it hides errors # My own wait_for because it hides errors

View file

@ -18,6 +18,7 @@ module Fog
attribute :disks, :aliases => 'disks' attribute :disks, :aliases => 'disks'
attribute :kernel, :aliases => 'kernel' attribute :kernel, :aliases => 'kernel'
attribute :metadata attribute :metadata
attribute :tags, :squash => 'items'
def destroy def destroy
requires :name, :zone requires :name, :zone
@ -112,7 +113,8 @@ module Fog
'externalIp' => external_ip, 'externalIp' => external_ip,
'disks' => disks, 'disks' => disks,
'kernel' => kernel, 'kernel' => kernel,
'metadata' => metadata 'metadata' => metadata,
'tags' => tags
}.delete_if {|key, value| value.nil?} }.delete_if {|key, value| value.nil?}
service.insert_server(name, zone_name, options) service.insert_server(name, zone_name, options)

View file

@ -145,6 +145,8 @@ module Fog
options['metadata'] = format_metadata options['metadata'] if options['metadata'] options['metadata'] = format_metadata options['metadata'] if options['metadata']
body_object['tags'] = { 'items' => options.delete('tags') } if options['tags']
if options['kernel'] if options['kernel']
body_object['kernel'] = @api_url + "google/global/kernels/#{options.delete 'kernel'}" body_object['kernel'] = @api_url + "google/global/kernels/#{options.delete 'kernel'}"
end end