vagrant-google 0.1.5 → 0.2.0.rc1
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/.gitignore +4 -3
- data/.rubocop.yml +7 -0
- data/.rubocop_todo.yml +201 -0
- data/CHANGELOG.md +14 -0
- data/README.md +45 -22
- data/example_boxes/gce/Vagrantfile +23 -0
- data/example_boxes/gce-test/Vagrantfile +30 -0
- data/lib/vagrant-google/action/connect_google.rb +10 -14
- data/lib/vagrant-google/action/is_terminated.rb +31 -0
- data/lib/vagrant-google/action/run_instance.rb +58 -35
- data/lib/vagrant-google/action/start_instance.rb +90 -0
- data/lib/vagrant-google/action/stop_instance.rb +48 -0
- data/lib/vagrant-google/action/warn_networks.rb +2 -1
- data/lib/vagrant-google/action.rb +62 -12
- data/lib/vagrant-google/config.rb +56 -11
- data/lib/vagrant-google/errors.rb +13 -5
- data/lib/vagrant-google/version.rb +1 -1
- data/lib/vagrant-google.rb +3 -3
- data/locales/en.yml +33 -4
- data/tasks/acceptance.rake +20 -1
- data/tasks/lint.rake +3 -0
- data/tasks/test.rake +1 -0
- data/test/acceptance/provider/multi_instance_spec.rb +31 -0
- data/test/acceptance/provider/preemptible_spec.rb +26 -0
- data/test/acceptance/provider/scopes_spec.rb +29 -0
- data/test/acceptance/skeletons/multi_instance/Vagrantfile +29 -0
- data/test/acceptance/skeletons/preemptible/Vagrantfile +17 -0
- data/test/acceptance/skeletons/scopes/Vagrantfile +18 -0
- data/test/unit/base.rb +1 -1
- data/test/unit/common/config_test.rb +62 -13
- data/vagrant-google.gemspec +4 -3
- data/vagrant-spec.config.rb +2 -2
- data/vagrantfile_examples/Vagrantfile.multiple_machines +93 -0
- data/vagrantfile_examples/Vagrantfile.provision_single +48 -0
- data/vagrantfile_examples/Vagrantfile.simple +29 -0
- data/vagrantfile_examples/Vagrantfile.zone_config +40 -0
- metadata +39 -8
- data/lib/vagrant-google/action/sync_folders.rb +0 -104
@@ -0,0 +1,29 @@
|
|
1
|
+
# This tests that account scopes can be configured correctly
|
2
|
+
# Additionally, this verifies that the 'scopes' method alias is
|
3
|
+
# available and gcloud GCE aliases can be used.
|
4
|
+
# (see lib/fog/google/models/compute/server.rb in fog-google)
|
5
|
+
shared_examples 'provider/scopes' do |provider, options|
|
6
|
+
if !options[:box]
|
7
|
+
raise ArgumentError,
|
8
|
+
"box option must be specified for provider: #{provider}"
|
9
|
+
end
|
10
|
+
|
11
|
+
include_context 'acceptance'
|
12
|
+
|
13
|
+
before do
|
14
|
+
environment.skeleton('scopes')
|
15
|
+
assert_execute('vagrant', 'box', 'add', 'basic', options[:box])
|
16
|
+
assert_execute('vagrant', 'up', "--provider=#{provider}")
|
17
|
+
end
|
18
|
+
|
19
|
+
after do
|
20
|
+
assert_execute('vagrant', 'destroy', '--force')
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should bring up machine with scope definitions' do
|
24
|
+
status("Test: machine is running after up")
|
25
|
+
result = execute("vagrant", "ssh", "-c", "echo foo")
|
26
|
+
expect(result).to exit_with(0)
|
27
|
+
expect(result.stdout).to match(/foo\n$/)
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
Vagrant.configure("2") do |config|
|
2
|
+
config.vm.box = "basic"
|
3
|
+
|
4
|
+
config.vm.define :z1a do |z1a|
|
5
|
+
z1a.vm.provider :google do |google, override|
|
6
|
+
google.zone = "europe-west1-c"
|
7
|
+
|
8
|
+
google.zone_config "europe-west1-c" do |z1a_zone|
|
9
|
+
z1a_zone.name = "vagrant-testing-acceptance-multi-z1a"
|
10
|
+
z1a_zone.image = "debian-7-wheezy-v20150603"
|
11
|
+
z1a_zone.machine_type = "n1-standard-1"
|
12
|
+
z1a_zone.zone = "europe-west1-c"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
config.vm.define :z1b do |z1b|
|
18
|
+
z1b.vm.provider :google do |google, override|
|
19
|
+
google.zone = "europe-west1-d"
|
20
|
+
|
21
|
+
google.zone_config "europe-west1-d" do |z1b_zone|
|
22
|
+
z1b_zone.name = "vagrant-testing-acceptance-multi-z1b"
|
23
|
+
z1b_zone.image = "debian-7-wheezy-v20150603"
|
24
|
+
z1b_zone.machine_type = "n1-standard-2"
|
25
|
+
z1b_zone.zone = "europe-west1-d"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Vagrant.configure("2") do |config|
|
2
|
+
config.vm.box = "basic"
|
3
|
+
|
4
|
+
config.vm.provider :google do |google, override|
|
5
|
+
|
6
|
+
google.zone = "europe-west1-d"
|
7
|
+
|
8
|
+
google.zone_config "europe-west1-d" do |zone1d|
|
9
|
+
zone1d.name = "vagrant-testing-preemptible"
|
10
|
+
zone1d.image = "debian-7-wheezy-v20150603"
|
11
|
+
zone1d.zone = "europe-west1-d"
|
12
|
+
zone1d.preemptible = true
|
13
|
+
zone1d.auto_restart = false
|
14
|
+
zone1d.on_host_maintenance = "TERMINATE"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Vagrant.configure("2") do |config|
|
2
|
+
config.vm.box = "basic"
|
3
|
+
|
4
|
+
config.vm.provider :google do |google, override|
|
5
|
+
|
6
|
+
google.zone = "europe-west1-d"
|
7
|
+
|
8
|
+
google.zone_config "europe-west1-d" do |zone1d|
|
9
|
+
zone1d.name = "vagrant-testing-acceptance-scopes"
|
10
|
+
zone1d.scopes = ['sql-admin',
|
11
|
+
'bigquery',
|
12
|
+
'https://www.googleapis.com/auth/compute'
|
13
|
+
]
|
14
|
+
zone1d.image = "debian-7-wheezy-v20150603"
|
15
|
+
zone1d.zone = "europe-west1-d"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/test/unit/base.rb
CHANGED
@@ -29,19 +29,22 @@ describe VagrantPlugins::Google::Config do
|
|
29
29
|
o.finalize!
|
30
30
|
end
|
31
31
|
end
|
32
|
-
|
33
|
-
|
34
|
-
its("
|
35
|
-
its("
|
36
|
-
its("
|
37
|
-
its("
|
38
|
-
its("
|
39
|
-
its("
|
40
|
-
its("
|
41
|
-
its("disk_type") { should == "pd-standard" }
|
32
|
+
|
33
|
+
its("name") { should match "i-[0-9]{10}-[0-9a-f]{4}" }
|
34
|
+
its("image") { should == "debian-7-wheezy-v20150127" }
|
35
|
+
its("zone") { should == "us-central1-f" }
|
36
|
+
its("network") { should == "default" }
|
37
|
+
its("machine_type") { should == "n1-standard-1" }
|
38
|
+
its("disk_size") { should == 10 }
|
39
|
+
its("disk_name") { should be_nil }
|
40
|
+
its("disk_type") { should == "pd-standard" }
|
42
41
|
its("instance_ready_timeout") { should == 20 }
|
43
|
-
its("metadata")
|
44
|
-
its("tags")
|
42
|
+
its("metadata") { should == {} }
|
43
|
+
its("tags") { should == [] }
|
44
|
+
its("service_accounts") { should == nil }
|
45
|
+
its("preemptible") { should be_false }
|
46
|
+
its("auto_restart") { should }
|
47
|
+
its("on_host_maintenance") { should == "MIGRATE" }
|
45
48
|
end
|
46
49
|
|
47
50
|
describe "overriding defaults" do
|
@@ -50,7 +53,7 @@ describe VagrantPlugins::Google::Config do
|
|
50
53
|
# each of these attributes to "foo" in isolation, and reads the value
|
51
54
|
# and asserts the proper result comes back out.
|
52
55
|
[:name, :image, :zone, :instance_ready_timeout, :machine_type, :disk_size, :disk_name, :disk_type,
|
53
|
-
|
56
|
+
:network, :metadata, :can_ip_forward, :external_ip, :autodelete_disk].each do |attribute|
|
54
57
|
|
55
58
|
it "should not default #{attribute} if overridden" do
|
56
59
|
instance.send("#{attribute}=".to_sym, "foo")
|
@@ -58,6 +61,24 @@ describe VagrantPlugins::Google::Config do
|
|
58
61
|
instance.send(attribute).should == "foo"
|
59
62
|
end
|
60
63
|
end
|
64
|
+
|
65
|
+
it "should raise error when preemptible and auto_restart is true" do
|
66
|
+
instance.preemptible = true
|
67
|
+
instance.auto_restart = true
|
68
|
+
expected_error = "en.vagrant_google.config.auto_restart_invalid_on_preemptible"
|
69
|
+
instance.finalize!
|
70
|
+
errors = instance.validate("foo")["Google Provider"]
|
71
|
+
errors.inject(false) { |a, e| a or e.include?(expected_error) }.should == true
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should raise error when preemptible and on_host_maintenance is not TERMINATE" do
|
75
|
+
instance.preemptible = true
|
76
|
+
instance.on_host_maintenance = "MIGRATE"
|
77
|
+
expected_error = "en.vagrant_google.config.on_host_maintenance_invalid_on_preemptible"
|
78
|
+
instance.finalize!
|
79
|
+
errors = instance.validate("foo")["Google Provider"]
|
80
|
+
errors.inject(false) { |a, e| a or e.include?(expected_error) }.should == true
|
81
|
+
end
|
61
82
|
end
|
62
83
|
|
63
84
|
describe "getting credentials from environment" do
|
@@ -244,5 +265,33 @@ describe VagrantPlugins::Google::Config do
|
|
244
265
|
}
|
245
266
|
end
|
246
267
|
end
|
268
|
+
|
269
|
+
describe "zone_preemptible" do
|
270
|
+
let(:zone) { "hashi-zone" }
|
271
|
+
subject do
|
272
|
+
instance.zone = zone
|
273
|
+
instance.zone_config zone do |config|
|
274
|
+
config.preemptible = true
|
275
|
+
config.auto_restart = true
|
276
|
+
config.on_host_maintenance = "MIGRATE"
|
277
|
+
end
|
278
|
+
|
279
|
+
instance.tap do |o|
|
280
|
+
o.finalize!
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
it "should fail auto_restart validation" do
|
285
|
+
expected_error = "en.vagrant_google.config.auto_restart_invalid_on_preemptible"
|
286
|
+
errors = subject.validate("foo")["Google Provider"]
|
287
|
+
errors.inject(false) { |a, e| a or e.include?(expected_error) }.should == true
|
288
|
+
end
|
289
|
+
|
290
|
+
it "should fail on_host_maintenance validation" do
|
291
|
+
expected_error = "en.vagrant_google.config.on_host_maintenance_invalid_on_preemptible"
|
292
|
+
errors = subject.validate("foo")["Google Provider"]
|
293
|
+
errors.inject(false) { |a, e| a or e.include?(expected_error) }.should == true
|
294
|
+
end
|
295
|
+
end
|
247
296
|
end
|
248
297
|
end
|
data/vagrant-google.gemspec
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
|
15
|
+
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
16
16
|
require "vagrant-google/version"
|
17
17
|
|
18
18
|
Gem::Specification.new do |s|
|
@@ -28,14 +28,15 @@ 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", "
|
31
|
+
s.add_runtime_dependency "fog-google", "~> 0.0.7"
|
32
32
|
s.add_runtime_dependency "google-api-client"
|
33
33
|
#s.add_runtime_dependency "pry"
|
34
|
-
#s.add_runtime_dependency "pry-
|
34
|
+
#s.add_runtime_dependency "pry-byebug"
|
35
35
|
#s.add_runtime_dependency "rb-readline"
|
36
36
|
|
37
37
|
s.add_development_dependency "rake"
|
38
38
|
s.add_development_dependency "rspec", "~> 2.14.0"
|
39
|
+
s.add_development_dependency "rubocop", "0.31.0"
|
39
40
|
|
40
41
|
# The following block of code determines the files that should be included
|
41
42
|
# in the gem. It does this by reading all the files in the directory where
|
data/vagrant-spec.config.rb
CHANGED
@@ -5,6 +5,6 @@ Vagrant::Spec::Acceptance.configure do |c|
|
|
5
5
|
c.skeleton_paths << File.expand_path("../test/acceptance/skeletons", __FILE__)
|
6
6
|
|
7
7
|
c.provider "google",
|
8
|
-
|
9
|
-
|
8
|
+
box: "https://github.com/mitchellh/vagrant-google/raw/master/google-test.box",
|
9
|
+
contexts: ["provider-context/google"]
|
10
10
|
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
# Copyright 2013 Google Inc. All Rights Reserved.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Usage:
|
18
|
+
# 1) Launch both instances and then destroy both
|
19
|
+
# $ vagrant up --provider=google
|
20
|
+
# $ vagrant destroy
|
21
|
+
# 2) Launch one instance 'z1c' and then destory the same
|
22
|
+
# $ vagrant up z1c --provider=google
|
23
|
+
# $ vagrant destroy z1c
|
24
|
+
|
25
|
+
# Customize these global variables
|
26
|
+
$GOOGLE_PROJECT_ID = "YOUR_GOOGLE_CLOUD_PROJECT_ID"
|
27
|
+
$GOOGLE_CLIENT_EMAIL = "YOUR_SERVICE_ACCOUNT_EMAIL_ADDRESS"
|
28
|
+
$GOOGLE_JSON_KEY_LOCATION = "/path/to/your/private-key.json"
|
29
|
+
$LOCAL_USER = "mitchellh"
|
30
|
+
$LOCAL_SSH_KEY = "~/.ssh/id_rsa"
|
31
|
+
|
32
|
+
# Example Debian provistion script
|
33
|
+
$PROVISION_DEBIAN = <<SCRIPT
|
34
|
+
uname=$(uname -a)
|
35
|
+
ver=$(cat /etc/debian_version)
|
36
|
+
echo "== BEGIN: vagrant provisioning on '${uname}'"
|
37
|
+
echo "== DEBIAN VERSION: ${ver}"
|
38
|
+
echo "== UPDATING Debian repositories and packages"
|
39
|
+
/usr/bin/apt-get update -y -qq > /dev/null 2>&1
|
40
|
+
/usr/bin/apt-get upgrade -y -qq > /dev/null 2>&1
|
41
|
+
extip=$(curl -s http://bot.whatismyipaddress.com)
|
42
|
+
echo "== EXTERNAL IP: ${extip}"
|
43
|
+
echo "== APPENDING /etc/motd"
|
44
|
+
d=$(date +%r)
|
45
|
+
echo "# ${d}" >> /etc/motd
|
46
|
+
echo "== cat /etc/motd"
|
47
|
+
cat /etc/motd
|
48
|
+
SCRIPT
|
49
|
+
|
50
|
+
Vagrant.configure("2") do |config|
|
51
|
+
config.vm.box = "gce"
|
52
|
+
config.vm.provision :shell, :inline => $PROVISION_DEBIAN
|
53
|
+
|
54
|
+
config.vm.define :z1c do |z1c|
|
55
|
+
z1c.vm.provider :google do |google, override|
|
56
|
+
google.google_project_id = $GOOGLE_PROJECT_ID
|
57
|
+
google.google_client_email = $GOOGLE_CLIENT_EMAIL
|
58
|
+
google.google_json_key_location = $GOOGLE_JSON_KEY_LOCATION
|
59
|
+
google.zone = "us-central1-c"
|
60
|
+
|
61
|
+
override.ssh.username = $LOCAL_USER
|
62
|
+
override.ssh.private_key_path = $LOCAL_SSH_KEY
|
63
|
+
|
64
|
+
google.zone_config "us-central1-c" do |z1c_zone|
|
65
|
+
z1c_zone.name = "z1c"
|
66
|
+
z1c_zone.image = "debian-7-wheezy-v20150603"
|
67
|
+
z1c_zone.machine_type = "n1-standard-1"
|
68
|
+
z1c_zone.zone = "us-central1-c"
|
69
|
+
z1c_zone.metadata = {"zone" => "US Central 1c"}
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
config.vm.define :z1f do |z1f|
|
75
|
+
z1f.vm.provider :google do |google, override|
|
76
|
+
google.google_project_id = $GOOGLE_PROJECT_ID
|
77
|
+
google.google_client_email = $GOOGLE_CLIENT_EMAIL
|
78
|
+
google.google_json_key_location = $GOOGLE_JSON_KEY_LOCATION
|
79
|
+
google.zone = "us-central1-f"
|
80
|
+
|
81
|
+
override.ssh.username = $LOCAL_USER
|
82
|
+
override.ssh.private_key_path = $LOCAL_SSH_KEY
|
83
|
+
|
84
|
+
google.zone_config "us-central1-f" do |z1f_zone|
|
85
|
+
z1f_zone.name = "z1f"
|
86
|
+
z1f_zone.image = "debian-7-wheezy-v20150603"
|
87
|
+
z1f_zone.machine_type = "n1-standard-2"
|
88
|
+
z1f_zone.zone = "us-central1-f"
|
89
|
+
z1f_zone.metadata = {"zone" => "US Central 1f"}
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
# Copyright 2013 Google Inc. All Rights Reserved.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Usage:
|
18
|
+
# $ vagrant up --provider=google
|
19
|
+
# $ vagrant destroy
|
20
|
+
|
21
|
+
# Customize these global variables
|
22
|
+
$GOOGLE_PROJECT_ID = "YOUR_GOOGLE_CLOUD_PROJECT_ID"
|
23
|
+
$GOOGLE_CLIENT_EMAIL = "YOUR_SERVICE_ACCOUNT_EMAIL_ADDRESS"
|
24
|
+
$GOOGLE_JSON_KEY_LOCATION = "/path/to/your/private-key.json"
|
25
|
+
$LOCAL_USER = "mitchellh"
|
26
|
+
$LOCAL_SSH_KEY = "~/.ssh/id_rsa"
|
27
|
+
|
28
|
+
Vagrant.configure("2") do |config|
|
29
|
+
|
30
|
+
config.vm.box = "gce"
|
31
|
+
|
32
|
+
config.vm.provider :google do |google, override|
|
33
|
+
google.google_project_id = $GOOGLE_PROJECT_ID
|
34
|
+
google.google_client_email = $GOOGLE_CLIENT_EMAIL
|
35
|
+
google.google_json_key_location = $GOOGLE_JSON_KEY_LOCATION
|
36
|
+
|
37
|
+
# Override provider defaults
|
38
|
+
google.name = "testing-vagrant"
|
39
|
+
google.image = "debian-7-wheezy-v20150603"
|
40
|
+
google.machine_type = "n1-standard-1"
|
41
|
+
google.zone = "us-central1-f"
|
42
|
+
google.metadata = {'custom' => 'metadata', 'testing' => 'foobarbaz'}
|
43
|
+
google.tags = ['vagrantbox', 'dev']
|
44
|
+
|
45
|
+
override.ssh.username = $LOCAL_USER
|
46
|
+
override.ssh.private_key_path = $LOCAL_SSH_KEY
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- mde: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
# Copyright 2013 Google Inc. All Rights Reserved.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
Vagrant.configure("2") do |config|
|
18
|
+
config.vm.box = "gce"
|
19
|
+
|
20
|
+
config.vm.provider :google do |google, override|
|
21
|
+
google.google_project_id = "YOUR_GOOGLE_CLOUD_PROJECT_ID"
|
22
|
+
google.google_client_email = "YOUR_SERVICE_ACCOUNT_EMAIL_ADDRESS"
|
23
|
+
google.google_json_key_location = "/path/to/your/private-key.json"
|
24
|
+
|
25
|
+
override.ssh.username = "mitchellh"
|
26
|
+
override.ssh.private_key_path = "~/.ssh/id_rsa"
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# -*- mde: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
# Copyright 2013 Google Inc. All Rights Reserved.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
Vagrant.configure("2") do |config|
|
18
|
+
config.vm.box = "gce"
|
19
|
+
|
20
|
+
config.vm.provider :google do |google, override|
|
21
|
+
google.google_project_id = "YOUR_GOOGLE_CLOUD_PROJECT_ID"
|
22
|
+
google.google_client_email = "YOUR_SERVICE_ACCOUNT_EMAIL_ADDRESS"
|
23
|
+
google.google_json_key_location = "/path/to/your/private-key.json"
|
24
|
+
|
25
|
+
override.ssh.username = "mitchellh"
|
26
|
+
override.ssh.private_key_path = "~/.ssh/id_rsa"
|
27
|
+
|
28
|
+
# Make sure to set this to trigger the zone_config
|
29
|
+
google.zone = "us-central1-f"
|
30
|
+
|
31
|
+
google.zone_config "us-central1-f" do |zone1a|
|
32
|
+
zone1a.name = "testing-vagrant"
|
33
|
+
zone1a.image = "debian-7-wheezy-v20150603"
|
34
|
+
zone1a.machine_type = "n1-standard-4"
|
35
|
+
zone1a.zone = "us-central1-f"
|
36
|
+
zone1a.scopes = ['bigquery', 'monitoring', 'https://www.googleapis.com/auth/compute']
|
37
|
+
zone1a.metadata = {'custom' => 'metadata', 'testing' => 'foobarbaz'}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
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: 0.
|
4
|
+
version: 0.2.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Johnson
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-07-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name: fog
|
15
|
+
name: fog-google
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ~>
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: 0.0.7
|
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:
|
27
|
+
version: 0.0.7
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: google-api-client
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,6 +67,20 @@ dependencies:
|
|
67
67
|
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: 2.14.0
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rubocop
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 0.31.0
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - '='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 0.31.0
|
70
84
|
description: Enables Vagrant to manage Google Compute Engine instances.
|
71
85
|
email: vagrant-google@google.com
|
72
86
|
executables: []
|
@@ -79,7 +93,9 @@ files:
|
|
79
93
|
- README.md
|
80
94
|
- Rakefile
|
81
95
|
- example_boxes/README.md
|
96
|
+
- example_boxes/gce-test/Vagrantfile
|
82
97
|
- example_boxes/gce-test/metadata.json
|
98
|
+
- example_boxes/gce/Vagrantfile
|
83
99
|
- example_boxes/gce/metadata.json
|
84
100
|
- google-test.box
|
85
101
|
- google.box
|
@@ -87,13 +103,15 @@ files:
|
|
87
103
|
- lib/vagrant-google/action.rb
|
88
104
|
- lib/vagrant-google/action/connect_google.rb
|
89
105
|
- lib/vagrant-google/action/is_created.rb
|
106
|
+
- lib/vagrant-google/action/is_terminated.rb
|
90
107
|
- lib/vagrant-google/action/message_already_created.rb
|
91
108
|
- lib/vagrant-google/action/message_not_created.rb
|
92
109
|
- lib/vagrant-google/action/message_will_not_destroy.rb
|
93
110
|
- lib/vagrant-google/action/read_ssh_info.rb
|
94
111
|
- lib/vagrant-google/action/read_state.rb
|
95
112
|
- lib/vagrant-google/action/run_instance.rb
|
96
|
-
- lib/vagrant-google/action/
|
113
|
+
- lib/vagrant-google/action/start_instance.rb
|
114
|
+
- lib/vagrant-google/action/stop_instance.rb
|
97
115
|
- lib/vagrant-google/action/terminate_instance.rb
|
98
116
|
- lib/vagrant-google/action/timed_provision.rb
|
99
117
|
- lib/vagrant-google/action/warn_networks.rb
|
@@ -106,14 +124,27 @@ files:
|
|
106
124
|
- locales/en.yml
|
107
125
|
- tasks/acceptance.rake
|
108
126
|
- tasks/bundler.rake
|
127
|
+
- tasks/lint.rake
|
109
128
|
- tasks/test.rake
|
110
129
|
- test/acceptance/base.rb
|
130
|
+
- test/acceptance/provider/multi_instance_spec.rb
|
131
|
+
- test/acceptance/provider/preemptible_spec.rb
|
132
|
+
- test/acceptance/provider/scopes_spec.rb
|
111
133
|
- test/acceptance/shared/context_google.rb
|
134
|
+
- test/acceptance/skeletons/multi_instance/Vagrantfile
|
135
|
+
- test/acceptance/skeletons/preemptible/Vagrantfile
|
136
|
+
- test/acceptance/skeletons/scopes/Vagrantfile
|
112
137
|
- test/unit/base.rb
|
113
138
|
- test/unit/common/config_test.rb
|
114
139
|
- vagrant-google.gemspec
|
115
140
|
- vagrant-spec.config.rb
|
141
|
+
- vagrantfile_examples/Vagrantfile.multiple_machines
|
142
|
+
- vagrantfile_examples/Vagrantfile.provision_single
|
143
|
+
- vagrantfile_examples/Vagrantfile.simple
|
144
|
+
- vagrantfile_examples/Vagrantfile.zone_config
|
116
145
|
- .gitignore
|
146
|
+
- .rubocop.yml
|
147
|
+
- .rubocop_todo.yml
|
117
148
|
- .ruby-version
|
118
149
|
homepage: http://www.vagrantup.com
|
119
150
|
licenses: []
|