fog-google 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad43648d6ec49a3e00c06ef22da0f2c12e84919c
4
- data.tar.gz: cf6f8b28815b5ee18dfdce87306559c058eb49b9
3
+ metadata.gz: 65e4868fbdd7a60000ea6a349ce4f693c39bd62c
4
+ data.tar.gz: 92c1d9a1f79427c290e499896a8d454eb9d78556
5
5
  SHA512:
6
- metadata.gz: 5df9ade71b8ac3430be566e5f8006425f6b8dd38ffeb5130f53c6c0d76a12fa56d73eec811a2c72342cbb669fdc0de2df796c037c3fbd32a26be2e2e6c41e8b2
7
- data.tar.gz: aaa5bbe014e6d4c44438f068d8137abeb18276b25196ebb212ed54af9e98ca3c9d46d794a780cfd5869399451f654aac190095d983f23a56a7a45de7c54adf87
6
+ metadata.gz: 8d14851bab45918fec8f0d4cbb48ad6768b6ddeb298e0241f4b09b7ba918615251758ec22ef2636e1d481ee84ffae8bef4952107242a722523953141b1e2f799
7
+ data.tar.gz: 4236f7940f9f9d86362cd18ea0e0eccf466768f9ebcb3ae7a54d7c48bbbdfbff8139f06107f69837593cfb3a1684f5529b2c2e59b252fc1ea5f4040760d1c6cd
@@ -25,7 +25,7 @@ def test
25
25
  :private_key_path => File.expand_path("~/.ssh/id_rsa"),
26
26
  :public_key_path => File.expand_path("~/.ssh/id_rsa.pub"),
27
27
  :zone_name => "us-central1-f",
28
- :user => ENV["USER"],
28
+ :username => ENV["USER"],
29
29
  :tags => ["fog"],
30
30
  :service_accounts => %w(sql-admin bigquery https://www.googleapis.com/auth/compute)
31
31
  )
@@ -207,21 +207,7 @@ module Fog
207
207
  end
208
208
 
209
209
  def add_ssh_key(username, key)
210
- self.metadata = Hash.new("") if metadata.nil?
211
-
212
- # The key "sshKeys" is deprecated and will be unsupported in the
213
- # future - for now defer to using 'ssh-keys' unless the user is
214
- # already using the deprecated version
215
- # https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys#deprecated
216
- metadata_key = metadata.key?("sshKeys") ? "sshKeys" : "ssh-keys"
217
-
218
- # You can have multiple SSH keys, seperated by newlines.
219
- # https://developers.google.com/compute/docs/console?hl=en#sshkeys
220
- metadata[metadata_key] = "" unless metadata[metadata_key]
221
- metadata[metadata_key] += "\n" unless metadata[metadata_key].empty?
222
- metadata[metadata_key] += "#{username}:#{key.strip}"
223
-
224
- set_metadata(metadata)
210
+ set_metadata(generate_ssh_key_metadata(username, key))
225
211
  end
226
212
 
227
213
  def map_service_accounts(scope_array)
@@ -259,7 +245,7 @@ module Fog
259
245
  raise ArgumentError.new "#{zone_name.inspect} is either down or you don't have permission to use it."
260
246
  end
261
247
 
262
- add_ssh_key(username, public_key) if public_key
248
+ generate_ssh_key_metadata(username, public_key) if public_key
263
249
 
264
250
  options = {
265
251
  "machineType" => machine_type,
@@ -289,6 +275,26 @@ module Fog
289
275
  operation.wait_for { !pending? }
290
276
  reload
291
277
  end
278
+
279
+ private
280
+
281
+ def generate_ssh_key_metadata(username, key)
282
+ self.metadata = Hash.new("") if metadata.nil?
283
+
284
+ # The key "sshKeys" is deprecated and will be unsupported in the
285
+ # future - for now defer to using 'ssh-keys' unless the user is
286
+ # already using the deprecated version
287
+ # https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys#deprecated
288
+ metadata_key = metadata.key?("sshKeys") ? "sshKeys" : "ssh-keys"
289
+
290
+ # You can have multiple SSH keys, seperated by newlines.
291
+ # https://developers.google.com/compute/docs/console?hl=en#sshkeys
292
+ metadata[metadata_key] = "" unless metadata[metadata_key]
293
+ metadata[metadata_key] += "\n" unless metadata[metadata_key].empty?
294
+ metadata[metadata_key] += "#{username}:#{key.strip}"
295
+
296
+ metadata
297
+ end
292
298
  end
293
299
  end
294
300
  end
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Google
3
- VERSION = "0.5.1".freeze
3
+ VERSION = "0.5.2".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-google
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nat Welch
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2017-01-12 00:00:00.000000000 Z
14
+ date: 2017-01-13 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: fog-core
@@ -725,7 +725,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
725
725
  version: '0'
726
726
  requirements: []
727
727
  rubyforge_project:
728
- rubygems_version: 2.5.1
728
+ rubygems_version: 2.4.5.1
729
729
  signing_key:
730
730
  specification_version: 4
731
731
  summary: Module for the 'fog' gem to support Google.