From 89d406a2b3991a33c721868e2280bf2da00805b8 Mon Sep 17 00:00:00 2001 From: Jeremy MAURO Date: Tue, 7 Feb 2023 10:55:59 +0100 Subject: [PATCH] Fix/login command (#269) * (fix)podman: Fix the command used to login to container STATE: kitchen-dokken is now podman compliant, but there is no way currently to change the binary called to login to the container PROPOSED SOLUTION: Provide the option 'login_command' in the dokken transport to select which binary to use to login. Signed-off-by: Jeremy MAURO * doc(podman): Document the "login_cmmand" directive Signed-off-by: Jeremy MAURO * Updated the documentation Signed-off-by: Ashique P S --------- Signed-off-by: Jeremy MAURO Signed-off-by: Ashique P S Co-authored-by: Ashique P S --- documentation/PODMAN.md | 3 +++ lib/kitchen/transport/dokken.rb | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/documentation/PODMAN.md b/documentation/PODMAN.md index c1bad50..7c778f8 100644 --- a/documentation/PODMAN.md +++ b/documentation/PODMAN.md @@ -17,6 +17,7 @@ provisioner: transport: name: dokken + login_command: podman verifier: name: inspec @@ -50,3 +51,5 @@ suites: post_destroy: - podman volume prune -f ``` + +_Note:_ Specifying `podman` as the `login_command` in the `transport` section can solve the issue if you are unable to log into the instance using `kitchen login` when Docker isn't installed on your machine. diff --git a/lib/kitchen/transport/dokken.rb b/lib/kitchen/transport/dokken.rb index a542984..a315ead 100644 --- a/lib/kitchen/transport/dokken.rb +++ b/lib/kitchen/transport/dokken.rb @@ -43,6 +43,7 @@ class Dokken < Kitchen::Transport::Base default_config :docker_host_url, default_docker_host default_config :read_timeout, 3600 default_config :write_timeout, 3600 + default_config :login_command, "docker" default_config :host_ip_override do |transport| transport.docker_for_mac_or_win? ? "localhost" : false end @@ -172,7 +173,7 @@ def login_command cols = `tput cols` lines = `tput lines` args = ["exec", "-e", "COLUMNS=#{cols}", "-e", "LINES=#{lines}", "-it", @runner, "/bin/bash", "-login", "-i"] - LoginCommand.new("docker", args) + LoginCommand.new(options[:login_command], args) end private @@ -233,6 +234,7 @@ def connection_options(data) opts[:data_container] = data[:data_container] opts[:instance_name] = data[:instance_name] opts[:timeout] = data[:write_timeout] + opts[:login_command] = data[:login_command] opts end