vagrant-google 2.3.0 → 2.4.0.rc0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/lib/vagrant-google/action/connect_google.rb +13 -5
- data/lib/vagrant-google/config.rb +31 -14
- data/lib/vagrant-google/version.rb +1 -1
- data/locales/en.yml +0 -6
- data/test/unit/common/config_test.rb +38 -11
- data/vagrant-google.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 537db391735594007a72b2a4af1a464f90ac943e
|
4
|
+
data.tar.gz: 5235acd34a609e6e348cfd732fd1ed9d5c89ef8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9415a9c4f8a8fa50c6f648750d925c75cac489d618840dc1ba05ff4330d3707a23275835c5566bb135b01ea44d2249fae577a42d721aebd7c42961734cb7b63c
|
7
|
+
data.tar.gz: 79a35f14f4a8886037fb28b0485b3ec04bc3e4222b300c401f07766403b3a9d64df3b0c524f87b56806f7795d83d1e39af20aca13019f651c044f4fb3a15c26e
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,23 @@
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
The format is loosely based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
4
4
|
|
5
|
+
## 2.4.0 (April 2019)
|
6
|
+
|
7
|
+
### User-facing
|
8
|
+
|
9
|
+
#### Added
|
10
|
+
- \#213 Implemented Application Default Credentials authentication [mavin]
|
11
|
+
|
12
|
+
#### Fixed
|
13
|
+
- \#214 Set a default zone only if `default` network is used [mavin]
|
14
|
+
- \#215 Allow tags,labels and additional_disks to be merged with multiple
|
15
|
+
configs [mavin]
|
16
|
+
|
17
|
+
### Development
|
18
|
+
|
19
|
+
- \#213 Bumped dependencies [mavin]
|
20
|
+
- fog-google version to 1.9.0
|
21
|
+
|
5
22
|
## 2.3.0 (February 2019)
|
6
23
|
|
7
24
|
### User-facing
|
@@ -26,6 +26,7 @@ module VagrantPlugins
|
|
26
26
|
@logger = Log4r::Logger.new("vagrant_google::action::connect_google")
|
27
27
|
end
|
28
28
|
|
29
|
+
# Initialize Fog::Compute and add it to the environment
|
29
30
|
def call(env)
|
30
31
|
provider_config = env[:machine].provider_config
|
31
32
|
|
@@ -33,16 +34,23 @@ module VagrantPlugins
|
|
33
34
|
fog_config = {
|
34
35
|
:provider => :google,
|
35
36
|
:google_project => provider_config.google_project_id,
|
36
|
-
:google_client_email => provider_config.google_client_email
|
37
37
|
}
|
38
38
|
|
39
|
-
|
39
|
+
unless provider_config.google_client_email.nil?
|
40
|
+
fog_config[:google_client_email] = provider_config.google_client_email
|
41
|
+
end
|
40
42
|
|
41
|
-
|
42
|
-
|
43
|
+
unless provider_config.google_json_key_location.nil?
|
44
|
+
fog_config[:google_json_key_location] = find_key(provider_config.google_json_key_location, env)
|
45
|
+
end
|
46
|
+
|
47
|
+
if provider_config.google_client_email.nil? and provider_config.google_json_key_location.nil?
|
48
|
+
fog_config[:google_application_default] = true
|
49
|
+
end
|
43
50
|
|
51
|
+
@logger.info("Creating Google API client and adding to Vagrant environment")
|
52
|
+
env[:google_compute] = Fog::Compute.new(fog_config)
|
44
53
|
@app.call(env)
|
45
|
-
@logger.info("...Connected!")
|
46
54
|
end
|
47
55
|
|
48
56
|
# If the key is not found, try expanding from root location (see #159)
|
@@ -152,8 +152,8 @@ module VagrantPlugins
|
|
152
152
|
# @return [Int]
|
153
153
|
attr_accessor :instance_ready_timeout
|
154
154
|
|
155
|
-
# The zone to launch the instance into.
|
156
|
-
# use the default us-central1-f.
|
155
|
+
# The zone to launch the instance into.
|
156
|
+
# If nil and the "default" network is set use the default us-central1-f.
|
157
157
|
#
|
158
158
|
# @return [String]
|
159
159
|
attr_accessor :zone
|
@@ -277,6 +277,18 @@ module VagrantPlugins
|
|
277
277
|
# Merge in the metadata
|
278
278
|
result.metadata.merge!(self.metadata)
|
279
279
|
result.metadata.merge!(other.metadata)
|
280
|
+
|
281
|
+
# Merge in the labels
|
282
|
+
result.labels.merge!(self.labels)
|
283
|
+
result.labels.merge!(other.labels)
|
284
|
+
|
285
|
+
# Merge in the tags
|
286
|
+
result.tags |= self.tags
|
287
|
+
result.tags |= other.tags
|
288
|
+
|
289
|
+
# Merge in the additional disks
|
290
|
+
result.additional_disks |= self.additional_disks
|
291
|
+
result.additional_disks |= other.additional_disks
|
280
292
|
end
|
281
293
|
end
|
282
294
|
|
@@ -317,6 +329,7 @@ module VagrantPlugins
|
|
317
329
|
t = Time.now
|
318
330
|
@name = "i-#{t.strftime("%Y%m%d%H")}-" + SecureRandom.hex(4)
|
319
331
|
end
|
332
|
+
|
320
333
|
# Network defaults to 'default'
|
321
334
|
@network = "default" if @network == UNSET_VALUE
|
322
335
|
|
@@ -326,8 +339,13 @@ module VagrantPlugins
|
|
326
339
|
# Subnetwork defaults to nil
|
327
340
|
@subnetwork = nil if @subnetwork == UNSET_VALUE
|
328
341
|
|
329
|
-
# Default zone is us-central1-f
|
330
|
-
|
342
|
+
# Default zone is us-central1-f if using the default network
|
343
|
+
if @zone == UNSET_VALUE
|
344
|
+
@zone = nil
|
345
|
+
if @network == "default"
|
346
|
+
@zone = "us-central1-f"
|
347
|
+
end
|
348
|
+
end
|
331
349
|
|
332
350
|
# autodelete_disk defaults to true
|
333
351
|
@autodelete_disk = true if @autodelete_disk == UNSET_VALUE
|
@@ -403,13 +421,12 @@ module VagrantPlugins
|
|
403
421
|
# TODO: Check why provider-level settings are validated in the zone config
|
404
422
|
errors << I18n.t("vagrant_google.config.google_project_id_required") if \
|
405
423
|
config.google_project_id.nil?
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
File.exist?(File.expand_path(config.google_json_key_location.to_s, machine.env.root_path))
|
424
|
+
|
425
|
+
if config.google_json_key_location
|
426
|
+
errors << I18n.t("vagrant_google.config.private_key_missing") unless \
|
427
|
+
File.exist?(File.expand_path(config.google_json_key_location.to_s)) or
|
428
|
+
File.exist?(File.expand_path(config.google_json_key_location.to_s, machine.env.root_path))
|
429
|
+
end
|
413
430
|
|
414
431
|
if config.preemptible
|
415
432
|
errors << I18n.t("vagrant_google.config.auto_restart_invalid_on_preemptible") if \
|
@@ -422,10 +439,10 @@ module VagrantPlugins
|
|
422
439
|
errors << I18n.t("vagrant_google.config.image_and_image_family_set") if \
|
423
440
|
config.image
|
424
441
|
end
|
425
|
-
end
|
426
442
|
|
427
|
-
|
428
|
-
|
443
|
+
errors << I18n.t("vagrant_google.config.image_required") if config.image.nil? && config.image_family.nil?
|
444
|
+
errors << I18n.t("vagrant_google.config.name_required") if @name.nil?
|
445
|
+
end
|
429
446
|
|
430
447
|
if @service_accounts
|
431
448
|
machine.env.ui.warn(I18n.t("vagrant_google.config.service_accounts_deprecaated"))
|
data/locales/en.yml
CHANGED
@@ -52,9 +52,6 @@ en:
|
|
52
52
|
# Translations for config validation errors
|
53
53
|
#-------------------------------------------------------------------------------
|
54
54
|
config:
|
55
|
-
google_client_email_required: |-
|
56
|
-
A Google Service Account client email is required via
|
57
|
-
"google_client_email".
|
58
55
|
private_key_missing: |-
|
59
56
|
Private key for Google could not be found in the specified location.
|
60
57
|
zone_required: |-
|
@@ -63,9 +60,6 @@ en:
|
|
63
60
|
An instance name must be specified via "name" option.
|
64
61
|
image_required: |-
|
65
62
|
An image must be specified via "image" or "image_family" option.
|
66
|
-
google_key_location_required: |-
|
67
|
-
A private key pathname is required via:
|
68
|
-
"google_json_key_location" (for JSON keys)
|
69
63
|
google_project_id_required: |-
|
70
64
|
A Google Cloud Project ID is required via "google_project_id".
|
71
65
|
auto_restart_invalid_on_preemptible: |-
|
@@ -67,6 +67,13 @@ describe VagrantPlugins::Google::Config do
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
+
it "should raise error when network is not default and zone is not overriden" do
|
71
|
+
instance.network = "not-default"
|
72
|
+
instance.finalize!
|
73
|
+
errors = instance.validate("foo")["Google Provider"]
|
74
|
+
expect(errors).to include(/zone_required/)
|
75
|
+
end
|
76
|
+
|
70
77
|
it "should raise error when preemptible and auto_restart is true" do
|
71
78
|
instance.preemptible = true
|
72
79
|
instance.auto_restart = true
|
@@ -111,17 +118,6 @@ describe VagrantPlugins::Google::Config do
|
|
111
118
|
its("google_client_email") { should == "client_id_email" }
|
112
119
|
its("google_json_key_location") { should == "/path/to/json/key" }
|
113
120
|
end
|
114
|
-
|
115
|
-
context "With none of the Google credential environment variables set" do
|
116
|
-
before :each do
|
117
|
-
allow(ENV).to receive(:[]).with("GOOGLE_CLIENT_EMAIL").and_return("client_id_email")
|
118
|
-
end
|
119
|
-
|
120
|
-
it "Should return no key set errors" do
|
121
|
-
instance.finalize!
|
122
|
-
expect(instance.validate("foo")["Google Provider"][1]).to include("en.vagrant_google.config.google_key_location_required")
|
123
|
-
end
|
124
|
-
end
|
125
121
|
end
|
126
122
|
|
127
123
|
describe "zone config" do
|
@@ -251,6 +247,37 @@ describe VagrantPlugins::Google::Config do
|
|
251
247
|
"two" => "bar"
|
252
248
|
})
|
253
249
|
end
|
250
|
+
|
251
|
+
it "should merge the labels" do
|
252
|
+
first.labels["one"] = "one"
|
253
|
+
second.labels["two"] = "two"
|
254
|
+
|
255
|
+
third = first.merge(second)
|
256
|
+
expect(third.labels).to eq({
|
257
|
+
"one" => "one",
|
258
|
+
"two" => "two"
|
259
|
+
})
|
260
|
+
end
|
261
|
+
|
262
|
+
it "should merge the tags" do
|
263
|
+
first.tags = ["foo", "bar"]
|
264
|
+
second.tags = ["biz"]
|
265
|
+
|
266
|
+
third = first.merge(second)
|
267
|
+
expect(third.tags).to include("foo")
|
268
|
+
expect(third.tags).to include("bar")
|
269
|
+
expect(third.tags).to include("biz")
|
270
|
+
end
|
271
|
+
|
272
|
+
it "should merge the additional_disks" do
|
273
|
+
first.additional_disks = [{:one => "one"}]
|
274
|
+
second.additional_disks = [{:two => "two"}]
|
275
|
+
|
276
|
+
third = first.merge(second)
|
277
|
+
expect(third.additional_disks).to contain_exactly(
|
278
|
+
{:one => "one"}, {:two => "two"}
|
279
|
+
)
|
280
|
+
end
|
254
281
|
end
|
255
282
|
|
256
283
|
describe "zone_preemptible" do
|
data/vagrant-google.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.required_rubygems_version = ">= 1.3.6"
|
29
29
|
s.rubyforge_project = "vagrant-google"
|
30
30
|
|
31
|
-
s.add_runtime_dependency "fog-google", "~> 1.
|
31
|
+
s.add_runtime_dependency "fog-google", "~> 1.9.1"
|
32
32
|
|
33
33
|
# This is a restriction to avoid errors on `failure_message_for_should`
|
34
34
|
# TODO: revise after vagrant_spec goes past >0.0.1 (at master@e623a56)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-google
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0.rc0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Johnson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-04-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fog-google
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.
|
20
|
+
version: 1.9.1
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 1.
|
27
|
+
version: 1.9.1
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rspec-legacy_formatters
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|