kitchen-openstack 1.8.1 → 1.9.0.dev
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/README.md +22 -0
- data/Rakefile +2 -1
- data/lib/kitchen/driver/openstack.rb +27 -3
- data/lib/kitchen/driver/openstack_version.rb +1 -1
- data/spec/kitchen/driver/openstack_spec.rb +0 -29
- metadata +5 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7d16c235a1abe82961c4184bf0e91329fc09257e
|
|
4
|
+
data.tar.gz: 7d4dabf334f8c74f5101e8aae6514734fc33ccc3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f671a2b04efe4191d91dcc92f9639cb736e02d5207afd8d2ef5e3f3f00573e97f9024ccf4f5e4e2f08f4147f3a211e175378cac7d8c415b346af04b6f730a853
|
|
7
|
+
data.tar.gz: e294a4581e4d42042856e147546739ada5f3510b34b861da514f50d784c5866637ba6107b387f9b10218af12360592fc7c5e0a289c83e263529a1ec9be1c364b
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -105,6 +105,28 @@ Test Kitchen's SSH calls to the node.
|
|
|
105
105
|
floating_ip: [A SPECIFIC FLOATING IP TO ASSIGN]
|
|
106
106
|
floating_ip_pool: [AN OPENSTACK POOL NAME TO ASSIGN THE NEXT IP FROM]
|
|
107
107
|
|
|
108
|
+
In some complex network scenarios you can have several IP addresses designated
|
|
109
|
+
as public or private. Use `public_ip_order` or `private_ip_order` to control
|
|
110
|
+
which one to use for further SSH connection. Default is 0 (first one)
|
|
111
|
+
|
|
112
|
+
For example if you have openstack istance that has network with several IPs assigned like
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
+--------------------------------------+------------+--------+------------+-------------+----------------------------------+
|
|
116
|
+
| ID | Name | Status | Task State | Power State | Networks |
|
|
117
|
+
+--------------------------------------+------------+--------+------------+-------------+----------------------------------+
|
|
118
|
+
| 31c98de4-026f-4d12-b03f-a8a35c6e730b | kitchen | ACTIVE | None | Running | test=10.0.0.1, 10.0.1.1 |
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
to use second `10.0.1.1` IP address you need to specify
|
|
123
|
+
|
|
124
|
+
```yaml
|
|
125
|
+
private_ip_order: 1
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
assuming that test network is configured as private.
|
|
129
|
+
|
|
108
130
|
The `network_ref` option can be specified as an exact id, an exact name,
|
|
109
131
|
or as a regular expression matching the name of the network. You can pass one
|
|
110
132
|
|
data/Rakefile
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Encoding: UTF-8
|
|
2
2
|
|
|
3
3
|
require 'bundler/setup'
|
|
4
|
+
require 'bundler/gem_tasks'
|
|
4
5
|
require 'rubocop/rake_task'
|
|
5
6
|
require 'cane/rake_task'
|
|
6
7
|
require 'rspec/core/rake_task'
|
|
@@ -17,4 +18,4 @@ end
|
|
|
17
18
|
|
|
18
19
|
RSpec::Core::RakeTask.new(:spec)
|
|
19
20
|
|
|
20
|
-
task default: [:
|
|
21
|
+
task default: [:rubocop, :loc, :spec]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Encoding:
|
|
1
|
+
# Encoding: utf-8
|
|
2
2
|
#
|
|
3
3
|
# Author:: Jonathan Hartman (<j@p4nt5.com>)
|
|
4
4
|
#
|
|
@@ -30,7 +30,7 @@ module Kitchen
|
|
|
30
30
|
# Openstack driver for Kitchen.
|
|
31
31
|
#
|
|
32
32
|
# @author Jonathan Hartman <j@p4nt5.com>
|
|
33
|
-
class Openstack < Kitchen::Driver::SSHBase
|
|
33
|
+
class Openstack < Kitchen::Driver::SSHBase # rubocop:disable Metrics/ClassLength, Metrics/LineLength
|
|
34
34
|
@@ip_pool_lock = Mutex.new
|
|
35
35
|
|
|
36
36
|
default_config :server_name, nil
|
|
@@ -55,6 +55,8 @@ module Kitchen
|
|
|
55
55
|
default_config :openstack_network_name, nil
|
|
56
56
|
default_config :floating_ip_pool, nil
|
|
57
57
|
default_config :floating_ip, nil
|
|
58
|
+
default_config :private_ip_order, 0
|
|
59
|
+
default_config :public_ip_order, 0
|
|
58
60
|
default_config :availability_zone, nil
|
|
59
61
|
default_config :security_groups, nil
|
|
60
62
|
default_config :network_ref, nil
|
|
@@ -96,6 +98,7 @@ module Kitchen
|
|
|
96
98
|
end
|
|
97
99
|
state[:hostname] = get_ip(server)
|
|
98
100
|
setup_ssh(server, state)
|
|
101
|
+
wait_for_ssh_key_access(state)
|
|
99
102
|
add_ohai_hint(state)
|
|
100
103
|
rescue Fog::Errors::Error, Excon::Errors::Error => ex
|
|
101
104
|
raise ActionFailed, ex.message
|
|
@@ -114,6 +117,25 @@ module Kitchen
|
|
|
114
117
|
|
|
115
118
|
private
|
|
116
119
|
|
|
120
|
+
def wait_for_ssh_key_access(state)
|
|
121
|
+
new_state = build_ssh_args(state)
|
|
122
|
+
new_state[2][:number_of_password_prompts] = 0
|
|
123
|
+
info 'Checking ssh key authentication'
|
|
124
|
+
30.times do
|
|
125
|
+
ssh = Fog::SSH.new(*new_state)
|
|
126
|
+
begin
|
|
127
|
+
ssh.run([%(uname -a)])
|
|
128
|
+
rescue => e
|
|
129
|
+
info "Server not yet accepting SSH key: #{e.message}"
|
|
130
|
+
sleep 1
|
|
131
|
+
else
|
|
132
|
+
info 'SSH key authetication successful'
|
|
133
|
+
return
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
fail "30 seconds went by and we couldn't connect, somethings broken"
|
|
137
|
+
end
|
|
138
|
+
|
|
117
139
|
def openstack_server
|
|
118
140
|
server_def = {
|
|
119
141
|
provider: 'OpenStack'
|
|
@@ -305,7 +327,9 @@ module Kitchen
|
|
|
305
327
|
pub, priv = get_public_private_ips(server)
|
|
306
328
|
priv ||= server.ip_addresses unless pub
|
|
307
329
|
pub, priv = parse_ips(pub, priv)
|
|
308
|
-
pub.
|
|
330
|
+
pub[config[:public_ip_order].to_i] ||
|
|
331
|
+
priv[config[:private_ip_order].to_i] ||
|
|
332
|
+
fail(ActionFailed, 'Could not find an IP')
|
|
309
333
|
end
|
|
310
334
|
|
|
311
335
|
def parse_ips(pub, priv)
|
|
@@ -196,35 +196,6 @@ describe Kitchen::Driver::Openstack do
|
|
|
196
196
|
openstack_tenant: 'www'
|
|
197
197
|
}
|
|
198
198
|
end
|
|
199
|
-
|
|
200
|
-
it 'generates a server name in the absence of one' do
|
|
201
|
-
driver.create(state)
|
|
202
|
-
expect(driver[:server_name]).to eq('a_monkey!')
|
|
203
|
-
end
|
|
204
|
-
|
|
205
|
-
it 'gets a proper server ID' do
|
|
206
|
-
driver.create(state)
|
|
207
|
-
expect(state[:server_id]).to eq('test123')
|
|
208
|
-
end
|
|
209
|
-
|
|
210
|
-
it 'gets a proper hostname (IP)' do
|
|
211
|
-
driver.create(state)
|
|
212
|
-
expect(state[:hostname]).to eq('1.2.3.4')
|
|
213
|
-
end
|
|
214
|
-
|
|
215
|
-
it 'does not disable SSL validation' do
|
|
216
|
-
expect(driver).to_not receive(:disable_ssl_validation)
|
|
217
|
-
driver.create(state)
|
|
218
|
-
end
|
|
219
|
-
end
|
|
220
|
-
|
|
221
|
-
context 'SSL validation disabled' do
|
|
222
|
-
let(:config) { { disable_ssl_validation: true } }
|
|
223
|
-
|
|
224
|
-
it 'disables SSL cert validation' do
|
|
225
|
-
expect(driver).to receive(:disable_ssl_validation)
|
|
226
|
-
driver.create(state)
|
|
227
|
-
end
|
|
228
199
|
end
|
|
229
200
|
end
|
|
230
201
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kitchen-openstack
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.9.0.dev
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jonathan Hartman
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-09-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: test-kitchen
|
|
@@ -230,12 +230,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
230
230
|
version: 1.9.3
|
|
231
231
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
232
232
|
requirements:
|
|
233
|
-
- - "
|
|
233
|
+
- - ">"
|
|
234
234
|
- !ruby/object:Gem::Version
|
|
235
|
-
version:
|
|
235
|
+
version: 1.3.1
|
|
236
236
|
requirements: []
|
|
237
237
|
rubyforge_project:
|
|
238
|
-
rubygems_version: 2.
|
|
238
|
+
rubygems_version: 2.2.2
|
|
239
239
|
signing_key:
|
|
240
240
|
specification_version: 4
|
|
241
241
|
summary: A Test Kitchen OpenStack Nova driver
|
|
@@ -243,4 +243,3 @@ test_files:
|
|
|
243
243
|
- spec/kitchen/driver/openstack/volume_spec.rb
|
|
244
244
|
- spec/kitchen/driver/openstack_spec.rb
|
|
245
245
|
- spec/spec_helper.rb
|
|
246
|
-
has_rdoc:
|