kitchen-fog 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/kitchen/driver/fog.rb +3 -3
- data/lib/kitchen/driver/fog_version.rb +1 -1
- data/spec/kitchen/driver/fog_spec.rb +29 -11
- metadata +3 -2
data/README.md
CHANGED
@@ -50,7 +50,7 @@ By default, a unique server name will be generated and the current user's SSH
|
|
50
50
|
key will be used, though that behavior can be overridden with additional
|
51
51
|
options:
|
52
52
|
|
53
|
-
|
53
|
+
server_name: [A UNIQUE SERVER NAME]
|
54
54
|
ssh_key: [PATH TO YOUR PRIVATE SSH KEY]
|
55
55
|
upload_public_ssh_key: [TRUE UPLOADS PUBLIC KEY TO SERVER]
|
56
56
|
public_key_path: [PATH TO YOUR SSH PUBLIC KEY]
|
data/lib/kitchen/driver/fog.rb
CHANGED
@@ -29,7 +29,7 @@ module Kitchen
|
|
29
29
|
#
|
30
30
|
# @author Jonathan Hartman <j@p4nt5.com>
|
31
31
|
class Fog < Kitchen::Driver::SSHBase
|
32
|
-
default_config :
|
32
|
+
default_config :server_name, nil
|
33
33
|
default_config :public_key_path, File.expand_path('~/.ssh/id_dsa.pub')
|
34
34
|
default_config :username, 'root'
|
35
35
|
default_config :port, '22'
|
@@ -38,7 +38,7 @@ module Kitchen
|
|
38
38
|
default_config :upload_public_ssh_key, false
|
39
39
|
|
40
40
|
def create(state)
|
41
|
-
config[:
|
41
|
+
config[:server_name] ||= generate_name(instance.name)
|
42
42
|
config[:disable_ssl_validation] and disable_ssl_validation
|
43
43
|
server = create_server(state)
|
44
44
|
unless config[:floating_ip_create].nil?
|
@@ -96,7 +96,7 @@ module Kitchen
|
|
96
96
|
def create_server(state)
|
97
97
|
server_configed = config[:server_create] || {}
|
98
98
|
server_configed = server_configed.dup
|
99
|
-
server_configed[:name] = config[:
|
99
|
+
server_configed[:name] = config[:server_name]
|
100
100
|
server_configed = convert_to_strings(server_configed)
|
101
101
|
server = compute.servers.create(server_configed)
|
102
102
|
state[:server_id] = server.id
|
@@ -29,7 +29,9 @@ describe Kitchen::Driver::Fog do
|
|
29
29
|
let(:state) { Hash.new }
|
30
30
|
|
31
31
|
let(:instance) do
|
32
|
-
double(
|
32
|
+
double(
|
33
|
+
:name => 'potatoes', :logger => logger, :to_str => 'instance'
|
34
|
+
)
|
33
35
|
end
|
34
36
|
|
35
37
|
let(:driver) do
|
@@ -40,8 +42,8 @@ describe Kitchen::Driver::Fog do
|
|
40
42
|
|
41
43
|
describe '#initialize'do
|
42
44
|
context 'default options' do
|
43
|
-
it 'defaults to no name' do
|
44
|
-
driver[:
|
45
|
+
it 'defaults to no server name' do
|
46
|
+
driver[:server_name].should eq(nil)
|
45
47
|
end
|
46
48
|
|
47
49
|
it 'defaults to local user\'s SSH public key' do
|
@@ -82,7 +84,7 @@ describe Kitchen::Driver::Fog do
|
|
82
84
|
:public_key_path => '/tmp',
|
83
85
|
:username => 'admin',
|
84
86
|
:port => '2222',
|
85
|
-
:
|
87
|
+
:server_name => 'puppy',
|
86
88
|
:ssh_key => '/path/to/id_rsa'
|
87
89
|
}
|
88
90
|
end
|
@@ -134,7 +136,7 @@ describe Kitchen::Driver::Fog do
|
|
134
136
|
|
135
137
|
it 'generates a server name in the absence of one' do
|
136
138
|
driver.create(state)
|
137
|
-
driver[:
|
139
|
+
driver[:server_name].should eq('a_monkey!')
|
138
140
|
end
|
139
141
|
|
140
142
|
it 'gets a proper hostname (IP)' do
|
@@ -271,7 +273,7 @@ describe Kitchen::Driver::Fog do
|
|
271
273
|
describe '#create_server' do
|
272
274
|
let(:config) do
|
273
275
|
{
|
274
|
-
:
|
276
|
+
:server_name => 'hello',
|
275
277
|
:image_ref => 'there',
|
276
278
|
:flavor_ref => 'captain',
|
277
279
|
:public_key_path => 'tarpals'
|
@@ -295,7 +297,12 @@ describe Kitchen::Driver::Fog do
|
|
295
297
|
end
|
296
298
|
|
297
299
|
context 'a default config' do
|
298
|
-
before(:each)
|
300
|
+
before(:each) do
|
301
|
+
@expected = config.merge(:name => config[:server_name])
|
302
|
+
@expected.delete_if do |k, v|
|
303
|
+
k == :server_name
|
304
|
+
end
|
305
|
+
end
|
299
306
|
|
300
307
|
it 'creates the server using a compute connection' do
|
301
308
|
state = {}
|
@@ -307,13 +314,18 @@ describe Kitchen::Driver::Fog do
|
|
307
314
|
context 'a provided public key path' do
|
308
315
|
let(:config) do
|
309
316
|
{
|
310
|
-
:
|
317
|
+
:server_name => 'hello',
|
311
318
|
:image_ref => 'there',
|
312
319
|
:flavor_ref => 'captain',
|
313
320
|
:public_key_path => 'tarpals'
|
314
321
|
}
|
315
322
|
end
|
316
|
-
before(:each)
|
323
|
+
before(:each) do
|
324
|
+
@expected = config.merge(:name => config[:server_name])
|
325
|
+
@expected.delete_if do |k, v|
|
326
|
+
k == :server_name
|
327
|
+
end
|
328
|
+
end
|
317
329
|
|
318
330
|
it 'passes that public key path to Fog' do
|
319
331
|
state = {}
|
@@ -325,14 +337,20 @@ describe Kitchen::Driver::Fog do
|
|
325
337
|
context 'a provided key name' do
|
326
338
|
let(:config) do
|
327
339
|
{
|
328
|
-
:
|
340
|
+
:server_name => 'hello',
|
329
341
|
:image_ref => 'there',
|
330
342
|
:flavor_ref => 'captain',
|
331
343
|
:public_key_path => 'montgomery',
|
332
344
|
:key_name => 'tarpals'
|
333
345
|
}
|
334
346
|
end
|
335
|
-
|
347
|
+
|
348
|
+
before(:each) do
|
349
|
+
@expected = config.merge(:name => config[:server_name])
|
350
|
+
@expected.delete_if do |k, v|
|
351
|
+
k == :server_name
|
352
|
+
end
|
353
|
+
end
|
336
354
|
|
337
355
|
it 'passes that key name to Fog' do
|
338
356
|
state = {}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-fog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
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: 2013-12-
|
12
|
+
date: 2013-12-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: test-kitchen
|
@@ -186,3 +186,4 @@ summary: A Test Kitchen Fog Nova driver
|
|
186
186
|
test_files:
|
187
187
|
- spec/kitchen/driver/fog_spec.rb
|
188
188
|
- spec/spec_helper.rb
|
189
|
+
has_rdoc:
|