Skip to content

Commit

Permalink
Fix/login command (#269)
Browse files Browse the repository at this point in the history
* (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 <[email protected]>

* doc(podman): Document the "login_cmmand" directive

Signed-off-by: Jeremy MAURO <[email protected]>

* Updated the documentation

Signed-off-by: Ashique P S <[email protected]>

---------

Signed-off-by: Jeremy MAURO <[email protected]>
Signed-off-by: Ashique P S <[email protected]>
Co-authored-by: Ashique P S <[email protected]>
  • Loading branch information
jmauro and ashiqueps authored Feb 7, 2023
1 parent 950c3bd commit 89d406a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions documentation/PODMAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ provisioner:

transport:
name: dokken
login_command: podman

verifier:
name: inspec
Expand Down Expand Up @@ -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.
4 changes: 3 additions & 1 deletion lib/kitchen/transport/dokken.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 89d406a

Please sign in to comment.