From 884442d9d1a44c3ad30e51fbe0e0abdc6f0cbf26 Mon Sep 17 00:00:00 2001 From: Nat Welch Date: Tue, 12 Mar 2013 15:22:48 -0700 Subject: [PATCH] get rid of gAPI warnings and Fog deprecation notices. --- lib/fog/google/compute.rb | 5 ++++- lib/fog/google/models/compute/server.rb | 2 +- lib/fog/google/models/compute/servers.rb | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/fog/google/compute.rb b/lib/fog/google/compute.rb index 500b2ef29..fe40c1c18 100644 --- a/lib/fog/google/compute.rb +++ b/lib/fog/google/compute.rb @@ -79,7 +79,10 @@ module Fog @api_url = base_url + api_version + '/projects/' key = ::Google::APIClient::KeyUtils.load_from_pkcs12(File.expand_path(options[:google_key_location]), 'notasecret') - @client = ::Google::APIClient.new + @client = ::Google::APIClient.new( + :application_name => "fog", + :application_version => Fog::VERSION, + ) @client.authorization = Signet::OAuth2::Client.new( :audience => 'https://accounts.google.com/o/oauth2/token', :auth_provider_x509_cert_url => "https://www.googleapis.com/oauth2/v1/certs", diff --git a/lib/fog/google/models/compute/server.rb b/lib/fog/google/models/compute/server.rb index 3c3c398a1..d5aec56ea 100644 --- a/lib/fog/google/models/compute/server.rb +++ b/lib/fog/google/models/compute/server.rb @@ -6,7 +6,7 @@ module Fog class Server < Fog::Model - attribute :name, :aliases => 'identity' + identity :name attribute :image_name, :aliases => 'image' attribute :network_interfaces, :aliases => 'networkInterfaces' attribute :state, :aliases => 'status' diff --git a/lib/fog/google/models/compute/servers.rb b/lib/fog/google/models/compute/servers.rb index 6086965f4..22b83f9f9 100644 --- a/lib/fog/google/models/compute/servers.rb +++ b/lib/fog/google/models/compute/servers.rb @@ -15,7 +15,7 @@ module Fog end def get(identity) - data = connection.get_server(identity).body + data = service.get_server(identity).body new(data) rescue Excon::Errors::NotFound nil @@ -24,7 +24,7 @@ module Fog def bootstrap(new_attributes = {}) defaults = { - :name => "fog_#{Time.now.to_i}", + :name => "fog-#{Time.now.to_i}", :image_name => "", :machine_type => "", :zone_name => "",