Merge pull request #414 from mrsked/traefik-start-stop-run-errors

Don't hide Traefik errors
This commit is contained in:
Donal McBreen
2023-08-15 15:10:47 +01:00
committed by GitHub
3 changed files with 24 additions and 6 deletions

View File

@@ -4,7 +4,7 @@ class Mrsk::Cli::Traefik < Mrsk::Cli::Base
mutating do mutating do
on(MRSK.traefik_hosts) do on(MRSK.traefik_hosts) do
execute *MRSK.registry.login execute *MRSK.registry.login
execute *MRSK.traefik.run, raise_on_non_zero_exit: false execute *MRSK.traefik.start_or_run
end end
end end
end end
@@ -16,9 +16,9 @@ class Mrsk::Cli::Traefik < Mrsk::Cli::Base
on(MRSK.traefik_hosts, in: options[:rolling] ? :sequence : :parallel) do on(MRSK.traefik_hosts, in: options[:rolling] ? :sequence : :parallel) do
execute *MRSK.auditor.record("Rebooted traefik"), verbosity: :debug execute *MRSK.auditor.record("Rebooted traefik"), verbosity: :debug
execute *MRSK.registry.login execute *MRSK.registry.login
execute *MRSK.traefik.stop, raise_on_non_zero_exit: false execute *MRSK.traefik.stop
execute *MRSK.traefik.remove_container execute *MRSK.traefik.remove_container
execute *MRSK.traefik.run, raise_on_non_zero_exit: false execute *MRSK.traefik.run
end end
end end
end end
@@ -28,7 +28,7 @@ class Mrsk::Cli::Traefik < Mrsk::Cli::Base
mutating do mutating do
on(MRSK.traefik_hosts) do on(MRSK.traefik_hosts) do
execute *MRSK.auditor.record("Started traefik"), verbosity: :debug execute *MRSK.auditor.record("Started traefik"), verbosity: :debug
execute *MRSK.traefik.start, raise_on_non_zero_exit: false execute *MRSK.traefik.start
end end
end end
end end
@@ -38,7 +38,7 @@ class Mrsk::Cli::Traefik < Mrsk::Cli::Base
mutating do mutating do
on(MRSK.traefik_hosts) do on(MRSK.traefik_hosts) do
execute *MRSK.auditor.record("Stopped traefik"), verbosity: :debug execute *MRSK.auditor.record("Stopped traefik"), verbosity: :debug
execute *MRSK.traefik.stop, raise_on_non_zero_exit: false execute *MRSK.traefik.stop
end end
end end
end end

View File

@@ -30,6 +30,10 @@ class Mrsk::Commands::Traefik < Mrsk::Commands::Base
docker :container, :stop, "traefik" docker :container, :stop, "traefik"
end end
def start_or_run
combine start, run, by: "||"
end
def info def info
docker :ps, "--filter", "name=^traefik$" docker :ps, "--filter", "name=^traefik$"
end end

View File

@@ -1,7 +1,21 @@
require_relative "integration_test" require_relative "integration_test"
class TraefikTest < IntegrationTest class TraefikTest < IntegrationTest
test "boot, stop, start, restart, logs, remove" do test "boot, reboot, stop, start, restart, logs, remove" do
mrsk :traefik, :boot
assert_traefik_running
mrsk :traefik, :reboot
assert_traefik_running
mrsk :traefik, :boot
assert_traefik_running
# Check booting when booted doesn't raise an error
mrsk :traefik, :stop
assert_traefik_not_running
# Check booting when stopped works
mrsk :traefik, :boot mrsk :traefik, :boot
assert_traefik_running assert_traefik_running