vagrant-google 0.1.3

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.
data/locales/en.yml ADDED
@@ -0,0 +1,105 @@
1
+ en:
2
+ vagrant_google:
3
+ already_created: |-
4
+ The machine is already created.
5
+ launching_instance: |-
6
+ Launching an instance with the following settings...
7
+ launch_vpc_warning: |-
8
+ Warning! You're launching this instance into a VPC without an
9
+ elastic IP. Please verify you're properly connected to a VPN so
10
+ you can access this machine, otherwise Vagrant will not be able
11
+ to SSH into it.
12
+ not_created: |-
13
+ Instance is not created. Please run `vagrant up` first.
14
+ ready: |-
15
+ Machine is booted and ready for use!
16
+ ready_ssh: |-
17
+ Machine is ready for SSH access!
18
+ rsync_folder: |-
19
+ Rsyncing folder: %{hostpath} => %{guestpath}
20
+ terminating: |-
21
+ Terminating the instance...
22
+ waiting_for_ready: |-
23
+ Waiting for instance to become "ready"...
24
+ waiting_for_ssh: |-
25
+ Waiting for SSH to become available...
26
+ warn_networks: |-
27
+ Warning! The Google provider doesn't support any of the Vagrant
28
+ high-level network configurations (`config.vm.network`). They
29
+ will be silently ignored.
30
+ will_not_destroy: |-
31
+ The instance '%{name}' will not be destroyed, since the confirmation
32
+ was declined.
33
+
34
+ config:
35
+ google_client_email_required: |-
36
+ A Google Service Account client email is required via "google_client_email"
37
+ machine_required: |-
38
+ An MACHINE_TYPE must be configured via "machine"
39
+ private_key_missing: |-
40
+ The specified private key for Google could not be found
41
+ zone_required: |-
42
+ A zone must be specified via "zone"
43
+ name_required: |-
44
+ An instance name must be specified via "name"
45
+ google_key_location_required: |-
46
+ A private key pathname is required via "google_key_location"
47
+ google_project_id_required: |-
48
+ A Google Cloud Project ID is required via "google_project_id"
49
+
50
+ errors:
51
+ fog_error: |-
52
+ There was an error talking to Google. The error message is shown
53
+ below:
54
+
55
+ %{message}
56
+ instance_ready_timeout: |-
57
+ The instance never became "ready" in Google. The timeout currently
58
+ set waiting for the instance to become ready is %{timeout} seconds.
59
+ Please verify that the machine properly boots. If you need more time
60
+ set the `instance_ready_timeout` configuration on the Google provider.
61
+ rsync_error: |-
62
+ There was an error when attemping to rsync a share folder.
63
+ Please inspect the error message below for more info.
64
+
65
+ Host path: %{hostpath}
66
+ Guest path: %{guestpath}
67
+ Error: %{stderr}
68
+
69
+ states:
70
+ short_not_created: |-
71
+ not created
72
+ long_not_created: |-
73
+ The Google instance is not created. Run `vagrant up` to create it.
74
+
75
+ short_PROVISIONING: |-
76
+ provsioning
77
+ long_PROVISIONING: |-
78
+ Resources are being reserved for this instance. This instance is
79
+ not yet running.
80
+
81
+ short_STAGING: |-
82
+ staging
83
+ long_STAGING: |-
84
+ Resources have been acquired and the instance is being prepared for
85
+ launch and should be in the RUNNING state soon.
86
+
87
+ short_RUNNING: |-
88
+ running
89
+ long_RUNNING: |-
90
+ The Google instance is running. To stop this machine, you can run
91
+ `vagrant halt`. To destroy the machine, you can run `vagrant destroy`.
92
+
93
+ short_STOPPED: |-
94
+ stopped
95
+ long_STOPPED: |-
96
+ The Google instance is not currently running, either due to a failure
97
+ , or the instance is being shut down. This is a temporary status;
98
+ the instance will move to either PROVISIONING or TERMINATED.
99
+
100
+ short_TERMINATED: |-
101
+ terminated
102
+ long_TERMINATED: |-
103
+ The Google instance failed for some reason or was shutdown. This is
104
+ a permanent status, and the only way to repair the instance is to
105
+ delete it with `vagrant destroy`.
@@ -0,0 +1,195 @@
1
+ # Copyright 2013 Google Inc. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ require "vagrant-google/config"
15
+
16
+ describe VagrantPlugins::Google::Config do
17
+ let(:instance) { described_class.new }
18
+
19
+ # Ensure tests are not affected by Google credential environment variables
20
+ before :each do
21
+ ENV.stub(:[] => nil)
22
+ end
23
+
24
+ describe "defaults" do
25
+ subject do
26
+ instance.tap do |o|
27
+ o.finalize!
28
+ end
29
+ end
30
+ t = Time.now
31
+
32
+ its("name") { should == "i-#{t.year}#{t.month.to_s.rjust(2,'0')}#{t.day.to_s.rjust(2,'0')}#{t.hour.to_s.rjust(2,'0')}" }
33
+ its("image") { should == "debian-7-wheezy-v20140619" }
34
+ its("zone") { should == "us-central1-a" }
35
+ its("network") { should == "default" }
36
+ its("machine_type") { should == "n1-standard-1" }
37
+ its("instance_ready_timeout") { should == 20 }
38
+ its("metadata") { should == {} }
39
+ end
40
+
41
+ describe "overriding defaults" do
42
+ # I typically don't meta-program in tests, but this is a very
43
+ # simple boilerplate test, so I cut corners here. It just sets
44
+ # each of these attributes to "foo" in isolation, and reads the value
45
+ # and asserts the proper result comes back out.
46
+ [:name, :image, :zone, :instance_ready_timeout, :machine_type, :network,
47
+ :metadata].each do |attribute|
48
+
49
+ it "should not default #{attribute} if overridden" do
50
+ instance.send("#{attribute}=".to_sym, "foo")
51
+ instance.finalize!
52
+ instance.send(attribute).should == "foo"
53
+ end
54
+ end
55
+ end
56
+
57
+ describe "getting credentials from environment" do
58
+ context "without Google credential environment variables" do
59
+ subject do
60
+ instance.tap do |o|
61
+ o.finalize!
62
+ end
63
+ end
64
+
65
+ its("google_client_email") { should be_nil }
66
+ its("google_key_location") { should be_nil }
67
+ end
68
+
69
+ context "with Google credential environment variables" do
70
+ before :each do
71
+ ENV.stub(:[]).with("GOOGLE_CLIENT_EMAIL").and_return("client_id_email")
72
+ ENV.stub(:[]).with("GOOGLE_KEY_LOCATION").and_return("/path/to/key")
73
+ end
74
+
75
+ subject do
76
+ instance.tap do |o|
77
+ o.finalize!
78
+ end
79
+ end
80
+
81
+ its("google_client_email") { should == "client_id_email" }
82
+ its("google_key_location") { should == "/path/to/key" }
83
+ end
84
+ end
85
+
86
+ describe "zone config" do
87
+ let(:config_image) { "foo" }
88
+ let(:config_machine_type) { "foo" }
89
+ let(:config_name) { "foo" }
90
+ let(:config_zone) { "foo" }
91
+ let(:config_network) { "foo" }
92
+
93
+ def set_test_values(instance)
94
+ instance.name = config_name
95
+ instance.network = config_network
96
+ instance.image = config_image
97
+ instance.machine_type = config_machine_type
98
+ instance.zone = config_zone
99
+ end
100
+
101
+ it "should raise an exception if not finalized" do
102
+ expect { instance.get_zone_config("us-central1-a") }.
103
+ to raise_error
104
+ end
105
+
106
+ context "with no specific config set" do
107
+ subject do
108
+ # Set the values on the top-level object
109
+ set_test_values(instance)
110
+
111
+ # Finalize so we can get the zone config
112
+ instance.finalize!
113
+
114
+ # Get a lower level zone
115
+ instance.get_zone_config("us-central1-a")
116
+ end
117
+
118
+ its("name") { should == config_name }
119
+ its("image") { should == config_image }
120
+ its("machine_type") { should == config_machine_type }
121
+ its("network") { should == config_network }
122
+ its("zone") { should == config_zone }
123
+ end
124
+
125
+ context "with a specific config set" do
126
+ let(:zone_name) { "hashi-zone" }
127
+
128
+ subject do
129
+ # Set the values on a specific zone
130
+ instance.zone_config zone_name do |config|
131
+ set_test_values(config)
132
+ end
133
+
134
+ # Finalize so we can get the zone config
135
+ instance.finalize!
136
+
137
+ # Get the zone
138
+ instance.get_zone_config(zone_name)
139
+ end
140
+
141
+ its("name") { should == config_name }
142
+ its("image") { should == config_image }
143
+ its("machine_type") { should == config_machine_type }
144
+ its("network") { should == config_network }
145
+ its("zone") { should == zone_name }
146
+ end
147
+
148
+ describe "inheritance of parent config" do
149
+ let(:zone) { "hashi-zone" }
150
+
151
+ subject do
152
+ # Set the values on a specific zone
153
+ instance.zone_config zone do |config|
154
+ config.image = "child"
155
+ end
156
+
157
+ # Set some top-level values
158
+ instance.image = "parent"
159
+
160
+ # Finalize and get the zone
161
+ instance.finalize!
162
+ instance.get_zone_config(zone)
163
+ end
164
+
165
+ its("image") { should == "child" }
166
+ end
167
+
168
+ describe "shortcut configuration" do
169
+ subject do
170
+ # Use the shortcut configuration to set some values
171
+ instance.zone_config "us-central1-a", :image => "child"
172
+ instance.finalize!
173
+ instance.get_zone_config("us-central1-a")
174
+ end
175
+
176
+ its("image") { should == "child" }
177
+ end
178
+
179
+ describe "merging" do
180
+ let(:first) { described_class.new }
181
+ let(:second) { described_class.new }
182
+
183
+ it "should merge the metadata" do
184
+ first.metadata["one"] = "foo"
185
+ second.metadata["two"] = "bar"
186
+
187
+ third = first.merge(second)
188
+ third.metadata.should == {
189
+ "one" => "foo",
190
+ "two" => "bar"
191
+ }
192
+ end
193
+ end
194
+ end
195
+ end
@@ -0,0 +1,75 @@
1
+ # Copyright 2013 Google Inc. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ $:.unshift File.expand_path("../lib", __FILE__)
16
+ require "vagrant-google/version"
17
+
18
+ Gem::Specification.new do |s|
19
+ s.name = "vagrant-google"
20
+ s.version = VagrantPlugins::Google::VERSION
21
+ s.platform = Gem::Platform::RUBY
22
+ s.authors = "Eric Johnson"
23
+ s.email = "erjohnso@google.com"
24
+ s.homepage = "http://www.vagrantup.com"
25
+ s.summary = "Vagrant provider plugin for Google Compute Engine."
26
+ s.description = "Enables Vagrant to manage Google Compute Engine instances."
27
+
28
+ s.required_rubygems_version = ">= 1.3.6"
29
+ s.rubyforge_project = "vagrant-google"
30
+
31
+ s.add_runtime_dependency "fog", "~> 1.22"
32
+ s.add_runtime_dependency "google-api-client"
33
+ #s.add_runtime_dependency "pry"
34
+ #s.add_runtime_dependency "pry-nav"
35
+ #s.add_runtime_dependency "rb-readline"
36
+
37
+ s.add_development_dependency "rake"
38
+ s.add_development_dependency "rspec-core", "~> 2.12.2"
39
+ s.add_development_dependency "rspec-expectations", "~> 2.12.1"
40
+ s.add_development_dependency "rspec-mocks", "~> 2.12.1"
41
+
42
+ # The following block of code determines the files that should be included
43
+ # in the gem. It does this by reading all the files in the directory where
44
+ # this gemspec is, and parsing out the ignored files from the gitignore.
45
+ # Note that the entire gitignore(5) syntax is not supported, specifically
46
+ # the "!" syntax, but it should mostly work correctly.
47
+ root_path = File.dirname(__FILE__)
48
+ all_files = Dir.chdir(root_path) { Dir.glob("**/{*,.*}") }
49
+ all_files.reject! { |file| [".", ".."].include?(File.basename(file)) }
50
+ gitignore_path = File.join(root_path, ".gitignore")
51
+ gitignore = File.readlines(gitignore_path)
52
+ gitignore.map! { |line| line.chomp.strip }
53
+ gitignore.reject! { |line| line.empty? || line =~ /^(#|!)/ }
54
+
55
+ unignored_files = all_files.reject do |file|
56
+ # Ignore any directories, the gemspec only cares about files
57
+ next true if File.directory?(file)
58
+ # Ignore any paths that match anything in the gitignore. We do
59
+ # two tests here:
60
+ #
61
+ # - First, test to see if the entire path matches the gitignore.
62
+ # - Second, match if the basename does, this makes it so that things
63
+ # like '.DS_Store' will match sub-directories too (same behavior
64
+ # as git).
65
+ #
66
+ gitignore.any? do |ignore|
67
+ File.fnmatch(ignore, file, File::FNM_PATHNAME) ||
68
+ File.fnmatch(ignore, File.basename(file), File::FNM_PATHNAME)
69
+ end
70
+ end
71
+
72
+ s.files = unignored_files
73
+ s.executables = unignored_files.map { |f| f[/^bin\/(.*)/, 1] }.compact
74
+ s.require_path = 'lib'
75
+ end
metadata ADDED
@@ -0,0 +1,176 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-google
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Eric Johnson
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-06-30 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: fog
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.22'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.22'
30
+ - !ruby/object:Gem::Dependency
31
+ name: google-api-client
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rspec-core
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 2.12.2
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 2.12.2
78
+ - !ruby/object:Gem::Dependency
79
+ name: rspec-expectations
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: 2.12.1
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 2.12.1
94
+ - !ruby/object:Gem::Dependency
95
+ name: rspec-mocks
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: 2.12.1
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 2.12.1
110
+ description: Enables Vagrant to manage Google Compute Engine instances.
111
+ email: erjohnso@google.com
112
+ executables: []
113
+ extensions: []
114
+ extra_rdoc_files: []
115
+ files:
116
+ - google.box
117
+ - README.md
118
+ - CONTRIB.md
119
+ - example_box/README.md
120
+ - example_box/metadata.json
121
+ - spec/vagrant-google/config_spec.rb
122
+ - CHANGELOG.md
123
+ - Gemfile
124
+ - LICENSE
125
+ - locales/en.yml
126
+ - vagrant-google.gemspec
127
+ - Rakefile
128
+ - lib/vagrant-google/version.rb
129
+ - lib/vagrant-google/action.rb
130
+ - lib/vagrant-google/provider.rb
131
+ - lib/vagrant-google/config.rb
132
+ - lib/vagrant-google/util/timer.rb
133
+ - lib/vagrant-google/action/read_ssh_info.rb
134
+ - lib/vagrant-google/action/timed_provision.rb
135
+ - lib/vagrant-google/action/message_already_created.rb
136
+ - lib/vagrant-google/action/terminate_instance.rb
137
+ - lib/vagrant-google/action/read_state.rb
138
+ - lib/vagrant-google/action/message_not_created.rb
139
+ - lib/vagrant-google/action/connect_google.rb
140
+ - lib/vagrant-google/action/sync_folders.rb
141
+ - lib/vagrant-google/action/run_instance.rb
142
+ - lib/vagrant-google/action/is_created.rb
143
+ - lib/vagrant-google/action/warn_networks.rb
144
+ - lib/vagrant-google/action/message_will_not_destroy.rb
145
+ - lib/vagrant-google/errors.rb
146
+ - lib/vagrant-google/plugin.rb
147
+ - lib/vagrant-google.rb
148
+ - .gitignore
149
+ homepage: http://www.vagrantup.com
150
+ licenses: []
151
+ post_install_message:
152
+ rdoc_options: []
153
+ require_paths:
154
+ - lib
155
+ required_ruby_version: !ruby/object:Gem::Requirement
156
+ none: false
157
+ requirements:
158
+ - - ! '>='
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ segments:
162
+ - 0
163
+ hash: -62560400084090535
164
+ required_rubygems_version: !ruby/object:Gem::Requirement
165
+ none: false
166
+ requirements:
167
+ - - ! '>='
168
+ - !ruby/object:Gem::Version
169
+ version: 1.3.6
170
+ requirements: []
171
+ rubyforge_project: vagrant-google
172
+ rubygems_version: 1.8.23
173
+ signing_key:
174
+ specification_version: 3
175
+ summary: Vagrant provider plugin for Google Compute Engine.
176
+ test_files: []