kitchen-digitalocean 0.4.0 → 0.5.0

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: 8b165d6d82fa2603ed9cdb1afbf284a75d10b2b1
4
- data.tar.gz: f4555427be6e7402c2d5a4db899d9d563febe2fb
3
+ metadata.gz: 98df1704d134fb5aa5ccf18954a090db4273f493
4
+ data.tar.gz: 9e722b98c0976ced48f415e370e61226647c4509
5
5
  SHA512:
6
- metadata.gz: b433accd2962cf696ecf0aa187661265a53bbf152ca20969df0b2c06ee54c6c25ea146d6a21feabfd1339859b283928b33a7813e6bf53d93ad7a6019b423edb7
7
- data.tar.gz: b9626c7fc0cba8b540efe016c43f6d8be988d063bc89abd436309393d0562cea7605059b865d66e5decd67388b8253ceb50d8a2bb33d81e5f4bc40768b1bfb6d
6
+ metadata.gz: 85c2321a1f81eb3f81102fe0dc0c0d9f0cfe76d2d937141bb21c2f74b9fff78a92cff1932792f2335f7e5cc3f17a3e15c41b5af4dc7c95c38aee97beea685385
7
+ data.tar.gz: b79b77190454fa593b47389722754bfa0906f4c43102b69f90c9bbc7fde91936e592999407552d508d184934300344969368ca907438902038674c9abcb66b0d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # 0.5.0 / 2013-12-31
2
+
3
+ * You can alternatively use region and flavor options instead of their _id counter parts.
4
+ See the readme for more information.
5
+
6
+ # 0.4.0 / 2013-12-31
7
+
8
+ * Updated the driver for test kitchen 1.1, fixed some bugs.
9
+ * Improved documentation
10
+ * It will now read your api key, client id, and ssh key ids, from environment variables if set.
11
+ * You can specify the image name rather than the image id
12
+
1
13
  # 0.3.1 / 2013-12-29
2
14
 
3
15
  * [@someara](https://github.com/someara) [PR #2] Relax test-kitchen version dep
data/README.md CHANGED
@@ -87,31 +87,25 @@ platforms:
87
87
  # ...
88
88
  ```
89
89
 
90
- For specific default values, please consult [images.json](https://github.com/gregf/kitchen-digitalocean/blob/master/data/images.json).
90
+ `flavor_id` and `region_id` can be set from the more friendly options flavor, and region like so.
91
91
 
92
- ### List of Regions
93
-
94
- ```shell
95
- ID Name
96
- 1 New York 1
97
- 2 Amsterdam 1
98
- 3 San Francisco 1
99
- 4 New York 2
92
+ ```ruby
93
+ driver:
94
+ - region: amsterdam 2
95
+ - flavor: 8GB
100
96
  ```
101
- ### List of Flavors (Sizes)
102
- ```shell
103
- ID Name
104
- 63 1GB
105
- 62 2GB
106
- 64 4GB
107
- 65 8GB
108
- 61 16GB
109
- 60 32GB
110
- 70 48GB
111
- 69 64GB
112
- 68 96GB
113
- 66 512MB
97
+
98
+ This will generate a configuration similiar to:
99
+
100
+ ```ruby
101
+ ---
102
+ driver:
103
+ - region_id: 5
104
+ - flavor: 65
114
105
  ```
106
+
107
+ For specific default values, please consult [images.json](https://github.com/gregf/kitchen-digitalocean/blob/master/data/digitalocean.json).
108
+
115
109
  # Development
116
110
 
117
111
  * Source hosted at [GitHub](https://github.com/gregf/kitchen-digitalocean)
@@ -0,0 +1,35 @@
1
+ {
2
+ "images": {
3
+ "ubuntu-10.04": "14097",
4
+ "ubuntu-12.10": "473123",
5
+ "ubuntu-13.04": "350076",
6
+ "ubuntu-13.10": "1505699",
7
+ "centos-5.8": "1601",
8
+ "centos-6.5": "1646467",
9
+ "centos-6.4": "562354",
10
+ "debian-6.0": "12573",
11
+ "debian-7.0": "308287",
12
+ "fedora-17": "32428",
13
+ "fedora-19": "696598",
14
+ "archlinux-2013.05": "350424"
15
+ },
16
+ "flavors": {
17
+ "512MB": "66",
18
+ "1GB": "63",
19
+ "2GB": "62",
20
+ "4GB": "64",
21
+ "8GB": "65",
22
+ "16GB": "61",
23
+ "32GB": "60",
24
+ "48GB": "70",
25
+ "64GB": "69",
26
+ "96GB": "68"
27
+ },
28
+ "regions": {
29
+ "New York 1": "1",
30
+ "New York 2": "4",
31
+ "Amsterdam 1": "2",
32
+ "Amsterdam 2": "5",
33
+ "San Francisco 1": "3"
34
+ }
35
+ }
@@ -28,11 +28,17 @@ module Kitchen
28
28
  #
29
29
  # @author Greg Fitzgerald <greg@gregf.org>
30
30
  class Digitalocean < Kitchen::Driver::SSHBase
31
- default_config :flavor_id, '66'
32
- default_config :region_id, '1'
33
31
  default_config :username, 'root'
34
32
  default_config :port, '22'
35
33
 
34
+ default_config :region_id do |driver|
35
+ driver.default_region
36
+ end
37
+
38
+ default_config :flavor_id do |driver|
39
+ driver.default_flavor
40
+ end
41
+
36
42
  default_config :image_id do |driver|
37
43
  driver.default_image
38
44
  end
@@ -80,8 +86,20 @@ module Kitchen
80
86
  state.delete(:hostname)
81
87
  end
82
88
 
89
+ def default_flavor
90
+ data['flavors'].fetch(config[:flavor] ? config[:flavor].upcase : nil) { '66' }
91
+ end
92
+
93
+ def default_region
94
+ regions = {}
95
+ data['regions'].each_pair do |key, value|
96
+ regions[key.upcase] = value
97
+ end
98
+ regions.fetch(config[:region] ? config[:region].upcase : nil) { '1' }
99
+ end
100
+
83
101
  def default_image
84
- images[instance.platform.name]
102
+ data['images'].fetch(instance.platform.name) { '473123' }
85
103
  end
86
104
 
87
105
  def default_name
@@ -116,10 +134,10 @@ module Kitchen
116
134
  )
117
135
  end
118
136
 
119
- def images
120
- @images ||= begin
137
+ def data
138
+ @data ||= begin
121
139
  json_file = File.expand_path(
122
- File.join(%w{.. .. .. .. data images.json}),
140
+ File.join(%w{.. .. .. .. data digitalocean.json}),
123
141
  __FILE__
124
142
  )
125
143
  JSON.load(IO.read(json_file))
@@ -19,7 +19,7 @@
19
19
  module Kitchen
20
20
  module Driver
21
21
  # Version string for Digital Ocean Kitchen driver
22
- DIGITALOCEAN_VERSION = '0.4.0'
22
+ DIGITALOCEAN_VERSION = '0.5.0'
23
23
  end
24
24
  end
25
25
 
@@ -107,7 +107,8 @@ describe Kitchen::Driver::Digitalocean do
107
107
  :username => 'admin',
108
108
  :port => '2222',
109
109
  :server_name => 'puppy',
110
- :region_id => '3'
110
+ :region_id => '1',
111
+ :flavor => '1GB'
111
112
  }
112
113
 
113
114
  let(:config) { config }
@@ -255,8 +256,8 @@ describe Kitchen::Driver::Digitalocean do
255
256
  {
256
257
  :server_name => 'hello',
257
258
  :image_id => 'there',
258
- :flavor_id => 'captain',
259
- :region_id => '1',
259
+ :flavor_id => '68',
260
+ :region_id => '3',
260
261
  :ssh_key_ids => '1234'
261
262
  }
262
263
  end
@@ -284,6 +285,26 @@ describe Kitchen::Driver::Digitalocean do
284
285
  end
285
286
  end
286
287
 
288
+ describe 'Region and Flavor names should be converted to IDs' do
289
+ let(:config) do
290
+ {
291
+ :server_name => 'hello',
292
+ :image_id => 'there',
293
+ :flavor => '2gb',
294
+ :region => 'amsterdam 2',
295
+ :ssh_key_ids => '1234'
296
+ }
297
+ end
298
+
299
+ it 'defaults to the correct flavor ID' do
300
+ expect(driver[:flavor_id]).to eq('62')
301
+ end
302
+
303
+ it 'defaults to the correct region ID' do
304
+ expect(driver[:region_id]).to eq('5')
305
+ end
306
+ end
307
+
287
308
  describe '#default_name' do
288
309
  before(:each) do
289
310
  Etc.stub(:getlogin).and_return('user')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-digitalocean
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Fitzgerald
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-31 00:00:00.000000000 Z
11
+ date: 2014-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen
@@ -123,7 +123,7 @@ files:
123
123
  - LICENSE.txt
124
124
  - README.md
125
125
  - Rakefile
126
- - data/images.json
126
+ - data/digitalocean.json
127
127
  - kitchen-digitalocean.gemspec
128
128
  - lib/kitchen/driver/digitalocean.rb
129
129
  - lib/kitchen/driver/digitalocean_version.rb
data/data/images.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "ubuntu-10.04": "14097",
3
- "ubuntu-12.10": "473123",
4
- "ubuntu-13.04": "350076",
5
- "ubuntu-13.10": "1505699",
6
- "centos-5.8": "1601",
7
- "centos-6.5": "1646467",
8
- "centos-6.4": "562354",
9
- "debian-6.0": "12573",
10
- "debian-7.0": "308287",
11
- "fedora-17": "32428",
12
- "fedora-19": "696598",
13
- "archlinux-2013.05": "350424"
14
- }