vagrant-google 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 0.1.4 (October 2014)
2
+
3
+ * Add option for disk size [franzs]
4
+ * Add tags [ptone]
5
+ * Updated default for latest Debian image
6
+
1
7
  # 0.1.3 (July 2014)
2
8
 
3
9
  * Updated all image references
data/README.md CHANGED
@@ -17,32 +17,19 @@ Vagrant, allowing Vagrant to control and provision instances in GCE.
17
17
 
18
18
  ## Usage
19
19
 
20
- Install does not yet work using standard Vagrant 1.1+ plugin installation methods.
21
- To install, clone and build the repo, and install from there. Something similar to the below
22
- ```sh
23
- mkdir -p ~/tmp && cd ~/tmp
24
- git clone https://github.com/mitchellh/vagrant-google
25
- cd vagrant-google
26
- bundle
27
- rake build
28
- cd ~
29
- ````
30
-
31
- # change out of the plugin source directory to avoid bundler issues
32
-
33
- ```sh
34
- vagrant plugin install ~/tmp/vagrant-google/pkg/vagrant-google-0.1.2.gem
35
- ```
36
-
37
- After installing, be sure to put a `Vagrant.require_plugin "vagrant-google"` at the top of your Vagrantfile so that Vagrant knows about the plugin.
38
- `vagrant up` and specify the `google` provider. For example,
20
+ Install using standard Vagrant 1.1+ plugin installation methods. After
21
+ installing, `vagrant up` and specify the `google` provider. For example,
39
22
 
40
23
  ```sh
24
+ $ vagrant plugin install vagrant-google
25
+ ...
41
26
  $ vagrant up --provider=google
27
+ ...
42
28
  ```
43
29
 
44
30
  Of course, prior to this you'll need to obtain a GCE-compatible box file for
45
- Vagrant.
31
+ Vagrant. You may also need to ensure you have a ruby-dev and other utilities
32
+ such as GNU make installed prior to installing the plugin.
46
33
 
47
34
  ## Google Cloud Platform Setup
48
35
 
@@ -55,21 +42,21 @@ Service Account for API Access.
55
42
  `Try it now` button.
56
43
  1. Create a new project and remember to record the `Project ID` you
57
44
  specify.
58
- 1. Next, visit the [API Console](https://code.google.com/apis/console/),
59
- select `Services` and enable the `Google Compute Engine` service for
60
- your project. If prompted, review and agree to the terms of service.
61
- 1. While still in the API Console, go to `API Access` and click on the
62
- `Create another client ID...` button. In the pop-up dialog, select
63
- the `Service Account` radio button and the click the `Create client ID`
45
+ 1. Next, visit the [Developers Console](https://console.developers.google.com)
46
+ make sure to enable the `Google Compute Engine` service for your project
47
+ If prompted, review and agree to the terms of service.
48
+ 1. While still in the Developers Console, go to `API & AUTH`, `Credentials`
49
+ section and click the `Create new Client ID` button. In the pop-up dialog,
50
+ select the `Service Account` radio button and the click the `Create Client ID`
64
51
  button.
65
52
  1. When prompted, select the `Download private key` button and make sure
66
53
  to save this file in a secure and reliable location. This key file
67
54
  will be used to authorize all Vagrant commands available in this plugin.
68
55
  1. Still on the same page, find the newly created `Service Account` text
69
- block on the API Access page. Record the `Email address` associated
70
- with the new Service Account you just created. You will need this
71
- email address and the location of the private key file to properly
72
- configure this Vagrant plugin.
56
+ block on the API Access page. Record the `Email address` (it should end
57
+ with `@developer.gserviceaccount.com`) associated with the new Service
58
+ Account you just created. You will need this email address and the
59
+ location of the private key file to properly configure this Vagrant plugin.
73
60
 
74
61
  ## Quick Start
75
62
 
@@ -105,7 +92,7 @@ end
105
92
 
106
93
  And then run `vagrant up --provider=google`.
107
94
 
108
- This will start an Debian 7 (Wheezy) instance in the us-central1-a zone,
95
+ This will start an Debian 7 (Wheezy) instance in the us-central1-f zone,
109
96
  with an n1-standard-1 machine, and the "default" network within your project.
110
97
  And assuming your SSH information was filled in properly within your
111
98
  Vagrantfile, SSH and provisioning will work as well.
@@ -137,10 +124,12 @@ This provider exposes quite a few provider-specific configuration options:
137
124
  * `instance_ready_timeout` - The number of seconds to wait for the instance
138
125
  to become "ready" in GCE. Defaults to 20 seconds.
139
126
  * `machine_type` - The machine type to use. The default is "n1-standard-1".
127
+ * `disk_size` - The disk size in GB. The default is 10.
140
128
  * `metadata` - Custom key/value pairs of metadata to add to the instance.
141
129
  * `name` - The name of your instance. The default is "new".
142
130
  * `network` - The name of the network to use for the instance. Default is
143
131
  "default".
132
+ * `tags` - An array of tags to apply to this instance.
144
133
  * `zone` - The zone name where the instance will be created.
145
134
 
146
135
  These can be set like typical provider-specific configuration:
@@ -173,14 +162,15 @@ Vagrant.configure("2") do |config|
173
162
  google.google_key_location = "/tmp/private-key.p12"
174
163
 
175
164
  # Make sure to set this to trigger the zone_config
176
- google.zone = "us-central2-a"
177
-
178
- google.zone_config "us-central2-a" do |zone2a|
179
- zone2a.name = "testing-vagrant"
180
- zone2a.image = "debian-7-wheezy-v20140619"
181
- zone2a.machine_type = "n1-standard-4"
182
- zone2a.zone = "us-central2-a"
183
- zone2a.metadata = {'custom' => 'metadata', 'testing' => 'foobarbaz'}
165
+ google.zone = "us-central1-f"
166
+
167
+ google.zone_config "us-central1-f" do |zone1f|
168
+ zone1f.name = "testing-vagrant"
169
+ zone1f.image = "debian-7-wheezy-v20140926"
170
+ zone1f.machine_type = "n1-standard-4"
171
+ zone1f.zone = "us-central1-f"
172
+ zone1f.metadata = {'custom' => 'metadata', 'testing' => 'foobarbaz'}
173
+ zone1f.tags = ['web', 'app1']
184
174
  end
185
175
  end
186
176
  end
@@ -211,9 +201,7 @@ puppet) to work!
211
201
 
212
202
  ## Known Issues
213
203
 
214
- * Can't boot from persistent disk - The underlying fog library does not
215
- currently support booting from a persistent disk.
216
- * No Tags - Tag support does not yet exist in the underlying fog library.
204
+ * https://github.com/mitchellh/vagrant-google/issues/17
217
205
 
218
206
  ## Development
219
207
 
@@ -39,22 +39,26 @@ module VagrantPlugins
39
39
  image = zone_config.image
40
40
  name = zone_config.name
41
41
  machine_type = zone_config.machine_type
42
+ disk_size = zone_config.disk_size
42
43
  network = zone_config.network
43
44
  metadata = zone_config.metadata
45
+ tags = zone_config.tags
44
46
 
45
47
  # Launch!
46
48
  env[:ui].info(I18n.t("vagrant_google.launching_instance"))
47
- env[:ui].info(" -- Name: #{name}")
48
- env[:ui].info(" -- Type: #{machine_type}")
49
- env[:ui].info(" -- Image: #{image}")
50
- env[:ui].info(" -- Zone: #{zone}") if zone
51
- env[:ui].info(" -- Network: #{network}") if network
52
- env[:ui].info(" -- Metadata: '#{metadata}'")
49
+ env[:ui].info(" -- Name: #{name}")
50
+ env[:ui].info(" -- Type: #{machine_type}")
51
+ env[:ui].info(" -- Disk size: #{disk_size} GB")
52
+ env[:ui].info(" -- Image: #{image}")
53
+ env[:ui].info(" -- Zone: #{zone}") if zone
54
+ env[:ui].info(" -- Network: #{network}") if network
55
+ env[:ui].info(" -- Metadata: '#{metadata}'")
56
+ env[:ui].info(" -- Tags: '#{tags}'")
53
57
  begin
54
58
  request_start_time = Time.now().to_i
55
59
  disk = env[:google_compute].disks.create(
56
60
  name: name,
57
- size_gb: 10,
61
+ size_gb: disk_size,
58
62
  zone_name: zone,
59
63
  source_image: image
60
64
  )
@@ -64,9 +68,11 @@ module VagrantPlugins
64
68
  :name => name,
65
69
  :zone_name => zone,
66
70
  :machine_type => machine_type,
71
+ :disk_size => disk_size,
67
72
  :image => image,
68
73
  :network => network,
69
74
  :metadata => metadata,
75
+ :tags => tags,
70
76
  # Second arg to get_as_boot_disk is 'autodelete_disk', defaulting
71
77
  # to true
72
78
  :disks => [disk.get_as_boot_disk(true, true)],
@@ -41,6 +41,11 @@ module VagrantPlugins
41
41
  # @return [String]
42
42
  attr_accessor :machine_type
43
43
 
44
+ # The size of disk in GB
45
+ #
46
+ # @return [Int]
47
+ attr_accessor :disk_size
48
+
44
49
  # The user metadata string
45
50
  #
46
51
  # @return [Hash<String, String>]
@@ -56,6 +61,11 @@ module VagrantPlugins
56
61
  # @return [String]
57
62
  attr_accessor :network
58
63
 
64
+ # Tags to apply to the instance
65
+ #
66
+ # @return [Array]
67
+ attr_accessor :tags
68
+
59
69
  # The timeout value waiting for instance ready
60
70
  #
61
71
  # @return [Int]
@@ -68,7 +78,7 @@ module VagrantPlugins
68
78
  #attr_accessor :tags
69
79
 
70
80
  # The zone to launch the instance into. If nil, it will
71
- # use the default us-central1-a.
81
+ # use the default us-central1-f.
72
82
  #
73
83
  # @return [String]
74
84
  attr_accessor :zone
@@ -79,9 +89,11 @@ module VagrantPlugins
79
89
  @google_project_id = UNSET_VALUE
80
90
  @image = UNSET_VALUE
81
91
  @machine_type = UNSET_VALUE
92
+ @disk_size = UNSET_VALUE
82
93
  @metadata = {}
83
94
  @name = UNSET_VALUE
84
95
  @network = UNSET_VALUE
96
+ @tags = []
85
97
  @instance_ready_timeout = UNSET_VALUE
86
98
  @zone = UNSET_VALUE
87
99
 
@@ -97,8 +109,8 @@ module VagrantPlugins
97
109
  # configuration object. This allows the user to override things like
98
110
  # image and machine type name for zones. Example:
99
111
  #
100
- # google.zone_config "us-central1-a" do |zone|
101
- # zone.image = "debian-7-wheezy-v20140619"
112
+ # google.zone_config "us-central1-f" do |zone|
113
+ # zone.image = "debian-7-wheezy-v20140926"
102
114
  # zone.machine_type = "n1-standard-4"
103
115
  # end
104
116
  #
@@ -161,11 +173,14 @@ module VagrantPlugins
161
173
  @google_project_id = ENV['GOOGLE_PROJECT_ID'] if @google_project_id == UNSET_VALUE
162
174
 
163
175
  # Image must be nil, since we can't default that
164
- @image = "debian-7-wheezy-v20140619" if @image == UNSET_VALUE
176
+ @image = "debian-7-wheezy-v20140926" if @image == UNSET_VALUE
165
177
 
166
178
  # Default instance type is an n1-standard-1
167
179
  @machine_type = "n1-standard-1" if @machine_type == UNSET_VALUE
168
180
 
181
+ # Default disk size is 10 GB
182
+ @disk_size = 10 if @disk_size == UNSET_VALUE
183
+
169
184
  # Instance name defaults to a new datetime value (hour granularity)
170
185
  t = Time.now
171
186
  @name = "i-#{t.year}#{t.month.to_s.rjust(2,'0')}#{t.day.to_s.rjust(2,'0')}#{t.hour.to_s.rjust(2,'0')}" if @name == UNSET_VALUE
@@ -173,8 +188,8 @@ module VagrantPlugins
173
188
  # Network defaults to 'default'
174
189
  @network = "default" if @network == UNSET_VALUE
175
190
 
176
- # Default zone is us-central1-a.
177
- @zone = "us-central1-a" if @zone == UNSET_VALUE
191
+ # Default zone is us-central1-f.
192
+ @zone = "us-central1-f" if @zone == UNSET_VALUE
178
193
 
179
194
  # Default instance_ready_timeout
180
195
  @instance_ready_timeout = 20 if @instance_ready_timeout == UNSET_VALUE
@@ -13,6 +13,6 @@
13
13
  # limitations under the License.
14
14
  module VagrantPlugins
15
15
  module Google
16
- VERSION = "0.1.3"
16
+ VERSION = "0.1.4"
17
17
  end
18
18
  end
@@ -30,12 +30,14 @@ describe VagrantPlugins::Google::Config do
30
30
  t = Time.now
31
31
 
32
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" }
33
+ its("image") { should == "debian-7-wheezy-v20140926" }
34
+ its("zone") { should == "us-central1-f" }
35
35
  its("network") { should == "default" }
36
36
  its("machine_type") { should == "n1-standard-1" }
37
+ its("disk_size") { should == 10 }
37
38
  its("instance_ready_timeout") { should == 20 }
38
39
  its("metadata") { should == {} }
40
+ its("tags") { should == [] }
39
41
  end
40
42
 
41
43
  describe "overriding defaults" do
@@ -43,8 +45,8 @@ describe VagrantPlugins::Google::Config do
43
45
  # simple boilerplate test, so I cut corners here. It just sets
44
46
  # each of these attributes to "foo" in isolation, and reads the value
45
47
  # and asserts the proper result comes back out.
46
- [:name, :image, :zone, :instance_ready_timeout, :machine_type, :network,
47
- :metadata].each do |attribute|
48
+ [:name, :image, :zone, :instance_ready_timeout, :machine_type, :disk_size,
49
+ :network, :metadata].each do |attribute|
48
50
 
49
51
  it "should not default #{attribute} if overridden" do
50
52
  instance.send("#{attribute}=".to_sym, "foo")
@@ -86,6 +88,7 @@ describe VagrantPlugins::Google::Config do
86
88
  describe "zone config" do
87
89
  let(:config_image) { "foo" }
88
90
  let(:config_machine_type) { "foo" }
91
+ let(:config_disk_size) { 99 }
89
92
  let(:config_name) { "foo" }
90
93
  let(:config_zone) { "foo" }
91
94
  let(:config_network) { "foo" }
@@ -95,11 +98,12 @@ describe VagrantPlugins::Google::Config do
95
98
  instance.network = config_network
96
99
  instance.image = config_image
97
100
  instance.machine_type = config_machine_type
101
+ instance.disk_size = config_disk_size
98
102
  instance.zone = config_zone
99
103
  end
100
104
 
101
105
  it "should raise an exception if not finalized" do
102
- expect { instance.get_zone_config("us-central1-a") }.
106
+ expect { instance.get_zone_config("us-central1-f") }.
103
107
  to raise_error
104
108
  end
105
109
 
@@ -112,12 +116,13 @@ describe VagrantPlugins::Google::Config do
112
116
  instance.finalize!
113
117
 
114
118
  # Get a lower level zone
115
- instance.get_zone_config("us-central1-a")
119
+ instance.get_zone_config("us-central1-f")
116
120
  end
117
121
 
118
122
  its("name") { should == config_name }
119
123
  its("image") { should == config_image }
120
124
  its("machine_type") { should == config_machine_type }
125
+ its("disk_size") { should == config_disk_size }
121
126
  its("network") { should == config_network }
122
127
  its("zone") { should == config_zone }
123
128
  end
@@ -141,6 +146,7 @@ describe VagrantPlugins::Google::Config do
141
146
  its("name") { should == config_name }
142
147
  its("image") { should == config_image }
143
148
  its("machine_type") { should == config_machine_type }
149
+ its("disk_size") { should == config_disk_size }
144
150
  its("network") { should == config_network }
145
151
  its("zone") { should == zone_name }
146
152
  end
@@ -168,9 +174,9 @@ describe VagrantPlugins::Google::Config do
168
174
  describe "shortcut configuration" do
169
175
  subject do
170
176
  # Use the shortcut configuration to set some values
171
- instance.zone_config "us-central1-a", :image => "child"
177
+ instance.zone_config "us-central1-f", :image => "child"
172
178
  instance.finalize!
173
- instance.get_zone_config("us-central1-a")
179
+ instance.get_zone_config("us-central1-f")
174
180
  end
175
181
 
176
182
  its("image") { should == "child" }
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.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-30 00:00:00.000000000 Z
12
+ date: 2014-10-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog
@@ -113,38 +113,38 @@ executables: []
113
113
  extensions: []
114
114
  extra_rdoc_files: []
115
115
  files:
116
- - google.box
116
+ - Rakefile
117
117
  - README.md
118
- - CONTRIB.md
119
- - example_box/README.md
120
- - example_box/metadata.json
121
- - spec/vagrant-google/config_spec.rb
118
+ - vagrant-google.gemspec
119
+ - locales/en.yml
122
120
  - CHANGELOG.md
123
- - Gemfile
124
121
  - LICENSE
125
- - locales/en.yml
126
- - vagrant-google.gemspec
127
- - Rakefile
128
- - lib/vagrant-google/version.rb
122
+ - CONTRIB.md
123
+ - Gemfile
129
124
  - 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
125
+ - lib/vagrant-google/action/run_instance.rb
134
126
  - lib/vagrant-google/action/timed_provision.rb
135
- - lib/vagrant-google/action/message_already_created.rb
136
127
  - lib/vagrant-google/action/terminate_instance.rb
137
- - lib/vagrant-google/action/read_state.rb
128
+ - lib/vagrant-google/action/read_ssh_info.rb
138
129
  - lib/vagrant-google/action/message_not_created.rb
139
130
  - lib/vagrant-google/action/connect_google.rb
140
- - lib/vagrant-google/action/sync_folders.rb
141
- - lib/vagrant-google/action/run_instance.rb
142
131
  - lib/vagrant-google/action/is_created.rb
143
- - lib/vagrant-google/action/warn_networks.rb
144
132
  - lib/vagrant-google/action/message_will_not_destroy.rb
145
- - lib/vagrant-google/errors.rb
133
+ - lib/vagrant-google/action/warn_networks.rb
134
+ - lib/vagrant-google/action/read_state.rb
135
+ - lib/vagrant-google/action/sync_folders.rb
136
+ - lib/vagrant-google/action/message_already_created.rb
137
+ - lib/vagrant-google/config.rb
146
138
  - lib/vagrant-google/plugin.rb
139
+ - lib/vagrant-google/version.rb
140
+ - lib/vagrant-google/provider.rb
141
+ - lib/vagrant-google/errors.rb
142
+ - lib/vagrant-google/util/timer.rb
147
143
  - lib/vagrant-google.rb
144
+ - example_box/README.md
145
+ - example_box/metadata.json
146
+ - google.box
147
+ - spec/vagrant-google/config_spec.rb
148
148
  - .gitignore
149
149
  homepage: http://www.vagrantup.com
150
150
  licenses: []
@@ -158,9 +158,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
158
158
  - - ! '>='
159
159
  - !ruby/object:Gem::Version
160
160
  version: '0'
161
- segments:
162
- - 0
163
- hash: -62560400084090535
164
161
  required_rubygems_version: !ruby/object:Gem::Requirement
165
162
  none: false
166
163
  requirements: