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 +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +16 -22
- data/data/digitalocean.json +35 -0
- data/lib/kitchen/driver/digitalocean.rb +24 -6
- data/lib/kitchen/driver/digitalocean_version.rb +1 -1
- data/spec/kitchen/driver/digitalocean_spec.rb +24 -3
- metadata +3 -3
- data/data/images.json +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98df1704d134fb5aa5ccf18954a090db4273f493
|
4
|
+
data.tar.gz: 9e722b98c0976ced48f415e370e61226647c4509
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
90
|
+
`flavor_id` and `region_id` can be set from the more friendly options flavor, and region like so.
|
91
91
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
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
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
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
|
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
|
120
|
-
@
|
137
|
+
def data
|
138
|
+
@data ||= begin
|
121
139
|
json_file = File.expand_path(
|
122
|
-
File.join(%w{.. .. .. .. data
|
140
|
+
File.join(%w{.. .. .. .. data digitalocean.json}),
|
123
141
|
__FILE__
|
124
142
|
)
|
125
143
|
JSON.load(IO.read(json_file))
|
@@ -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 => '
|
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 => '
|
259
|
-
:region_id => '
|
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
|
+
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:
|
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/
|
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
|
-
}
|