Fixed kamal-proxy remove command

This commit is contained in:
Igor Alexandrov
2024-10-31 10:56:43 +04:00
parent aa2906086a
commit 86657b0172
3 changed files with 7 additions and 7 deletions

View File

@@ -98,8 +98,8 @@ class Kamal::Cli::Accessory < Kamal::Cli::Base
execute *accessory.stop, raise_on_non_zero_exit: false execute *accessory.stop, raise_on_non_zero_exit: false
if accessory.running_proxy? if accessory.running_proxy?
target = accessory.container_id_for(container_name: accessory.service_name, only_running: true) target = capture_with_info(*accessory.container_id_for(container_name: accessory.service_name, only_running: true)).strip
execute *accessory.remove(target: target) execute *accessory.remove if target
end end
end end
end end

View File

@@ -2,7 +2,7 @@ class Kamal::Commands::Accessory < Kamal::Commands::Base
attr_reader :accessory_config attr_reader :accessory_config
delegate :service_name, :image, :hosts, :port, :files, :directories, :cmd, delegate :service_name, :image, :hosts, :port, :files, :directories, :cmd,
:network_args, :publish_args, :env_args, :volume_args, :label_args, :option_args, :network_args, :publish_args, :env_args, :volume_args, :label_args, :option_args,
:secrets_io, :secrets_path, :env_directory, :running_proxy?, :secrets_io, :secrets_path, :env_directory, :proxy, :running_proxy?,
to: :accessory_config to: :accessory_config
delegate :proxy_container_name, to: :config delegate :proxy_container_name, to: :config
@@ -41,11 +41,11 @@ class Kamal::Commands::Accessory < Kamal::Commands::Base
end end
def deploy(target:) def deploy(target:)
proxy_exec :deploy, service_name, *accessory_config.proxy.deploy_command_args(target: target) proxy_exec :deploy, service_name, *proxy.deploy_command_args(target: target)
end end
def remove(target:) def remove
proxy_exec :remove, service_name, *accessory_config.proxy.remove_command_args(target: target) proxy_exec :remove, service_name
end end

View File

@@ -177,7 +177,7 @@ class CommandsAccessoryTest < ActiveSupport::TestCase
test "remove" do test "remove" do
assert_equal \ assert_equal \
"docker exec kamal-proxy kamal-proxy remove custom-busybox --target \"172.1.0.2:80\"", "docker exec kamal-proxy kamal-proxy remove custom-busybox",
new_command(:busybox).remove(target: "172.1.0.2").join(" ") new_command(:busybox).remove(target: "172.1.0.2").join(" ")
end end