From 9f51ddde23d91ca60d529688daf74701c27cd6d2 Mon Sep 17 00:00:00 2001 From: Carlos Sanchez Date: Thu, 7 Nov 2013 20:45:03 +0100 Subject: [PATCH 1/2] [google] Add support for instance tags --- lib/fog/google/models/compute/server.rb | 4 +++- lib/fog/google/requests/compute/insert_server.rb | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/fog/google/models/compute/server.rb b/lib/fog/google/models/compute/server.rb index 67393fcb0..c40237fb3 100644 --- a/lib/fog/google/models/compute/server.rb +++ b/lib/fog/google/models/compute/server.rb @@ -18,6 +18,7 @@ module Fog attribute :disks, :aliases => 'disks' attribute :kernel, :aliases => 'kernel' attribute :metadata + attribute :tags, :squash => 'items' def destroy requires :name, :zone @@ -112,7 +113,8 @@ module Fog 'externalIp' => external_ip, 'disks' => disks, 'kernel' => kernel, - 'metadata' => metadata + 'metadata' => metadata, + 'tags' => tags }.delete_if {|key, value| value.nil?} service.insert_server(name, zone_name, options) diff --git a/lib/fog/google/requests/compute/insert_server.rb b/lib/fog/google/requests/compute/insert_server.rb index 5ca5dd428..34714761d 100644 --- a/lib/fog/google/requests/compute/insert_server.rb +++ b/lib/fog/google/requests/compute/insert_server.rb @@ -147,6 +147,8 @@ module Fog options['metadata'] = format_metadata options['metadata'] if options['metadata'] + body_object['tags'] = { 'items' => options.delete('tags') } if options['tags'] + if options['kernel'] body_object['kernel'] = @api_url + "google/global/kernels/#{options.delete 'kernel'}" end From d1095feffa663823c5ecf16f5689afc5423719b4 Mon Sep 17 00:00:00 2001 From: Carlos Sanchez Date: Thu, 7 Nov 2013 20:45:03 +0100 Subject: [PATCH 2/2] [google] Add support for instance tags --- lib/fog/google/examples/create.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/fog/google/examples/create.rb b/lib/fog/google/examples/create.rb index c2b77d860..fd4a163c4 100755 --- a/lib/fog/google/examples/create.rb +++ b/lib/fog/google/examples/create.rb @@ -9,6 +9,7 @@ def test :private_key_path => File.expand_path("~/.ssh/id_rsa"), :public_key_path => File.expand_path("~/.ssh/id_rsa.pub"), :user => ENV['USER'], + :tags => ["fog"] }) # My own wait_for because it hides errors