Skip to content

Commit

Permalink
fix: Use configured host URL when fetching docker information (test-k…
Browse files Browse the repository at this point in the history
…itchen#321)

Signed-off-by: Tom Hughes <[email protected]>
  • Loading branch information
tomhughes committed Apr 2, 2024
1 parent 054f2cf commit 0b5731e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 3 additions & 1 deletion lib/kitchen/driver/dokken.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ class Dokken < Kitchen::Driver::Base
default_config :dns, nil
default_config :dns_search, nil
default_config :docker_host_url, default_docker_host
default_config :docker_info, docker_info
default_config :docker_info do |driver|
docker_info(driver[:docker_host_url])
end
default_config :docker_registry, nil
default_config :entrypoint, nil
default_config :env, nil
Expand Down
4 changes: 2 additions & 2 deletions lib/kitchen/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ def default_docker_host
end
end

def docker_info
::Docker.url = default_docker_host
def docker_info(docker_host)
::Docker.url = docker_host

@docker_info ||= ::Docker.info
rescue Excon::Error::Socket
Expand Down
4 changes: 3 additions & 1 deletion lib/kitchen/provisioner/dokken.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ class Dokken < Kitchen::Provisioner::ChefZero
default_config :chef_log_level, "warn"
default_config :chef_output_format, "doc"
default_config :profile_ruby, false
default_config :docker_info, docker_info
default_config :docker_info do |provisioner|
docker_info(provisioner[:docker_host_url])
end
default_config :docker_host_url, default_docker_host

# Dokken is weird - the provisioner inherits from ChefZero but does not install
Expand Down
4 changes: 3 additions & 1 deletion lib/kitchen/transport/dokken.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ class Dokken < Kitchen::Transport::Base

plugin_version Kitchen::VERSION

default_config :docker_info, docker_info
default_config :docker_info do |transport|
docker_info(transport[:docker_host_url])
end
default_config :docker_host_url, default_docker_host
default_config :read_timeout, 3600
default_config :write_timeout, 3600
Expand Down

0 comments on commit 0b5731e

Please sign in to comment.