Merge pull request #759 from basecamp/details-accessory-host

Output the host when running accessory details
This commit is contained in:
Donal McBreen
2024-05-02 15:54:08 +01:00
committed by GitHub
2 changed files with 8 additions and 2 deletions

View File

@@ -107,8 +107,9 @@ class Kamal::Cli::Accessory < Kamal::Cli::Base
if name == "all"
KAMAL.accessory_names.each { |accessory_name| details(accessory_name) }
else
type = "Accessory #{name}"
with_accessory(name) do |accessory, hosts|
on(hosts) { puts capture_with_info(*accessory.info) }
on(hosts) { puts_by_host host, capture_with_info(*accessory.info), type: type }
end
end
end

View File

@@ -76,7 +76,10 @@ class CliAccessoryTest < CliTestCase
end
test "details" do
assert_match "docker ps --filter label=service=app-mysql", run_command("details", "mysql")
run_command("details", "mysql").tap do |output|
assert_match "docker ps --filter label=service=app-mysql", output
assert_match "Accessory mysql Host: 1.1.1.3", output
end
end
test "details with non-existent accessory" do
@@ -85,6 +88,8 @@ class CliAccessoryTest < CliTestCase
test "details with all" do
run_command("details", "all").tap do |output|
assert_match "Accessory mysql Host: 1.1.1.3", output
assert_match "Accessory redis Host: 1.1.1.2", output
assert_match "docker ps --filter label=service=app-mysql", output
assert_match "docker ps --filter label=service=app-redis", output
end