kitchen-fog 0.7.1 → 0.7.2
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.
- data/CHANGELOG.md +12 -0
- data/lib/kitchen/driver/fog.rb +12 -3
- data/lib/kitchen/driver/fog_version.rb +1 -1
- data/spec/kitchen/driver/fog_spec.rb +32 -1
- metadata +2 -2
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# 0.7.2 / 2013-12-20
|
|
2
|
+
|
|
3
|
+
### New Features
|
|
4
|
+
|
|
5
|
+
* PR [#4][] - Handle get_ip case when no plural address methods on Fog Server class; AWS support (thanks svanderbleek)
|
|
6
|
+
|
|
7
|
+
# 0.7.1 / 2013-10-02
|
|
8
|
+
|
|
9
|
+
### New Features
|
|
10
|
+
|
|
11
|
+
* PR [#3][] - Back port of server name issue (thanks bkw)
|
|
12
|
+
|
|
1
13
|
# 0.7.0 / 2013-10-02
|
|
2
14
|
|
|
3
15
|
### New Features
|
data/lib/kitchen/driver/fog.rb
CHANGED
|
@@ -147,14 +147,23 @@ module Kitchen
|
|
|
147
147
|
pub, priv = server.public_ip_addresses, server.private_ip_addresses
|
|
148
148
|
rescue Exception => e
|
|
149
149
|
# See Fog issue: https://github.com/fog/fog/issues/2160
|
|
150
|
-
|
|
151
|
-
addrs['public'] and pub = addrs['public'].map { |i| i['addr'] }
|
|
152
|
-
addrs['private'] and priv = addrs['private'].map { |i| i['addr'] }
|
|
150
|
+
pub, priv = extract_ips(server)
|
|
153
151
|
end
|
|
154
152
|
pub, priv = parse_ips(pub, priv)
|
|
155
153
|
pub.first || priv.first || raise(ActionFailed, 'Could not find an IP')
|
|
156
154
|
end
|
|
157
155
|
|
|
156
|
+
def extract_ips(server)
|
|
157
|
+
addrs = server.addresses
|
|
158
|
+
if addrs.any?
|
|
159
|
+
addrs['public'] and pub = addrs['public'].map { |i| i['addr'] }
|
|
160
|
+
addrs['private'] and priv = addrs['private'].map { |i| i['addr'] }
|
|
161
|
+
else
|
|
162
|
+
pub, priv = server.public_ip_address, server.private_ip_address
|
|
163
|
+
end
|
|
164
|
+
[pub, priv]
|
|
165
|
+
end
|
|
166
|
+
|
|
158
167
|
def parse_ips(pub, priv)
|
|
159
168
|
pub, priv = Array(pub), Array(priv)
|
|
160
169
|
if config[:use_ipv6]
|
|
@@ -387,6 +387,8 @@ describe Kitchen::Driver::Fog do
|
|
|
387
387
|
let(:addresses) { nil }
|
|
388
388
|
let(:public_ip_addresses) { nil }
|
|
389
389
|
let(:private_ip_addresses) { nil }
|
|
390
|
+
let(:public_ip_address) { nil }
|
|
391
|
+
let(:private_ip_address) { nil }
|
|
390
392
|
let(:parsed_ips) { [[], []] }
|
|
391
393
|
let(:driver) do
|
|
392
394
|
d = Kitchen::Driver::Fog.new(config)
|
|
@@ -397,7 +399,10 @@ describe Kitchen::Driver::Fog do
|
|
|
397
399
|
let(:server) do
|
|
398
400
|
double(:addresses => addresses,
|
|
399
401
|
:public_ip_addresses => public_ip_addresses,
|
|
400
|
-
:private_ip_addresses => private_ip_addresses
|
|
402
|
+
:private_ip_addresses => private_ip_addresses,
|
|
403
|
+
:public_ip_address => public_ip_address,
|
|
404
|
+
:private_ip_address => private_ip_address
|
|
405
|
+
)
|
|
401
406
|
end
|
|
402
407
|
|
|
403
408
|
context 'both public and private IPs' do
|
|
@@ -428,6 +433,32 @@ describe Kitchen::Driver::Fog do
|
|
|
428
433
|
end
|
|
429
434
|
end
|
|
430
435
|
|
|
436
|
+
context 'no method for plural addresses' do
|
|
437
|
+
let(:addresses) { [] }
|
|
438
|
+
let(:public_ip_address) { '5.5.5.5' }
|
|
439
|
+
let(:private_ip_address) { '4.4.4.4' }
|
|
440
|
+
let(:parsed_ips) { [[public_ip_address], [private_ip_address]] }
|
|
441
|
+
let(:no_method) { Proc.new { raise NoMethodError } }
|
|
442
|
+
|
|
443
|
+
before do
|
|
444
|
+
allow(server).to receive(:public_ip_addresses).and_return(no_method)
|
|
445
|
+
allow(server).to receive(:private_ip_addresses).and_return(no_method)
|
|
446
|
+
end
|
|
447
|
+
|
|
448
|
+
it 'returns a public IPv4 address' do
|
|
449
|
+
driver.send(:get_ip, server).should eq(public_ip_address)
|
|
450
|
+
end
|
|
451
|
+
|
|
452
|
+
context 'no public IP address' do
|
|
453
|
+
let(:public_ip_address) { nil }
|
|
454
|
+
let(:parsed_ips) { [[], [private_ip_address]] }
|
|
455
|
+
|
|
456
|
+
it 'returns a private IPv4 address' do
|
|
457
|
+
driver.send(:get_ip, server).should eq(private_ip_address)
|
|
458
|
+
end
|
|
459
|
+
end
|
|
460
|
+
end
|
|
461
|
+
|
|
431
462
|
context 'IPs in user-defined network group' do
|
|
432
463
|
let(:config) { { :network_name => 'mynetwork' } }
|
|
433
464
|
let(:addresses) do
|
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.2
|
|
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-20 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: test-kitchen
|