Skip to content

Commit

Permalink
Merge pull request #211 from test-kitchen/cw/fix-nil-on-create-container
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Smith <[email protected]>
  • Loading branch information
tas50 authored Dec 7, 2020
2 parents 6e01409 + f6de73c commit 63d0250
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/kitchen/driver/dokken.rb
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,16 @@ def create_chef_container(state)
lockfile = Lockfile.new "#{home_dir}/.dokken-#{chef_container_name}.lock"
begin
lockfile.lock
with_retries { ::Docker::Container.get(chef_container_name, {}, docker_connection) }
with_retries {
# TEMPORARY FIX - docker-api 2.0.0 has a buggy Docker::Container.get - use .all instead
# https://github.com/swipely/docker-api/issues/566
# ::Docker::Container.get(chef_container_name, {}, docker_connection)
found = ::Docker::Container.all({all: true}, docker_connection).select { |c| c.info["Names"].include?("/#{chef_container_name}") }
raise ::Docker::Error::NotFoundError.new(chef_container_name) if found.empty?
debug "Chef container already exists, continuing"
}
rescue ::Docker::Error::NotFoundError
debug "Chef container does not exist, creating a new Chef container"
with_retries do
begin
debug "driver - creating volume container #{chef_container_name} from #{chef_image}"
Expand Down

0 comments on commit 63d0250

Please sign in to comment.