Skip to content

Commit 1ec3569

Browse files
authored
Merge pull request #49 from Nowheresly/fixNoMethodError
Fixes #37 prevent NoMethodError when no hosts available
2 parents ed819a1 + f1f88c2 commit 1ec3569

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

controls/container_runtime.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@
223223
container_info = docker.object(id)
224224
next if container_info['NetworkSettings']['Ports'].nil?
225225
container_info['NetworkSettings']['Ports'].each do |_, hosts|
226+
next if hosts.nil?
226227
hosts.each do |host|
227228
describe host['HostPort'].to_i.between?(1, 1024) do
228229
it { should eq false }
@@ -354,6 +355,7 @@
354355
container_info = docker.object(id)
355356
next if container_info['NetworkSettings']['Ports'].nil?
356357
container_info['NetworkSettings']['Ports'].each do |_, hosts|
358+
next if hosts.nil?
357359
hosts.each do |host|
358360
describe host['HostIp'].to_i.between?(1, 1024) do
359361
it { should_not eq '0.0.0.0' }

0 commit comments

Comments
 (0)