From e6d436f6468795b48c18a5820e2246d1a08a2471 Mon Sep 17 00:00:00 2001 From: Donal McBreen Date: Fri, 5 Apr 2024 12:46:51 +0100 Subject: [PATCH] Output the host when running accessory details We already do this for app and Traefik hosts. --- lib/kamal/cli/accessory.rb | 3 ++- test/cli/accessory_test.rb | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/kamal/cli/accessory.rb b/lib/kamal/cli/accessory.rb index 64cd97cd..4c695a28 100644 --- a/lib/kamal/cli/accessory.rb +++ b/lib/kamal/cli/accessory.rb @@ -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 diff --git a/test/cli/accessory_test.rb b/test/cli/accessory_test.rb index a7913e0f..cb52ee2e 100644 --- a/test/cli/accessory_test.rb +++ b/test/cli/accessory_test.rb @@ -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