Upgrade on accessory hosts only with correct messages

This commit is contained in:
Donal McBreen
2024-09-18 09:18:28 +01:00
parent bd54c74682
commit 46c0836cd4
5 changed files with 15 additions and 19 deletions

View File

@@ -224,18 +224,14 @@ class Kamal::Cli::Accessory < Kamal::Cli::Base
def upgrade(name)
confirming "This will restart all accessories" do
with_lock do
if options[:rolling]
KAMAL.accessory_hosts.each do |host|
say "Upgrading accessories on #{host}...", :magenta
KAMAL.with_specific_hosts(host) do
reboot name
end
say "Upgraded accessories on #{host}...", :magenta
host_groups = options[:rolling] ? KAMAL.accessory_hosts : [ KAMAL.accessory_hosts ]
host_groups.each do |hosts|
host_list = Array(hosts).join(",")
KAMAL.with_specific_hosts(hosts) do
say "Upgrading #{name} accessories on #{host_list}...", :magenta
reboot name
say "Upgraded #{name} accessories on #{host_list}...", :magenta
end
else
say "Upgrading accessories on all hosts...", :magenta
reboot name
say "Upgraded accessories on all hosts", :magenta
end
end
end

View File

@@ -72,7 +72,7 @@ class Kamal::Cli::Proxy < Kamal::Cli::Base
host_groups = options[:rolling] ? KAMAL.hosts : [ KAMAL.hosts ]
host_groups.each do |hosts|
host_list = Array(hosts).join(",")
say "Upgrading proxy on #{host_list}..."
say "Upgrading proxy on #{host_list}...", :magenta
run_hook "pre-proxy-reboot", hosts: host_list
on(hosts) do |host|
execute *KAMAL.auditor.record("Rebooted proxy"), verbosity: :debug
@@ -97,7 +97,7 @@ class Kamal::Cli::Proxy < Kamal::Cli::Base
end
run_hook "post-proxy-reboot", hosts: host_list
say "Upgraded proxy on #{host_list}"
say "Upgraded proxy on #{host_list}", :magenta
end
end
end

View File

@@ -23,7 +23,7 @@ class Kamal::Commander::Specifics
end
def accessory_hosts
specific_hosts || config.accessories.flat_map(&:hosts)
config.accessories.flat_map(&:hosts) & specified_hosts
end
private