Skip to content

Commit

Permalink
Merge pull request #414 from mrsked/traefik-start-stop-run-errors
Browse files Browse the repository at this point in the history
Don't hide Traefik errors
  • Loading branch information
djmb authored Aug 15, 2023
2 parents 4262fce + c2d7fd7 commit dda7099
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
10 changes: 5 additions & 5 deletions lib/mrsk/cli/traefik.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def boot
mutating do
on(MRSK.traefik_hosts) do
execute *MRSK.registry.login
execute *MRSK.traefik.run, raise_on_non_zero_exit: false
execute *MRSK.traefik.start_or_run
end
end
end
Expand All @@ -16,9 +16,9 @@ def reboot
on(MRSK.traefik_hosts, in: options[:rolling] ? :sequence : :parallel) do
execute *MRSK.auditor.record("Rebooted traefik"), verbosity: :debug
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.run, raise_on_non_zero_exit: false
execute *MRSK.traefik.run
end
end
end
Expand All @@ -28,7 +28,7 @@ def start
mutating do
on(MRSK.traefik_hosts) do
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
Expand All @@ -38,7 +38,7 @@ def stop
mutating do
on(MRSK.traefik_hosts) do
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
Expand Down
4 changes: 4 additions & 0 deletions lib/mrsk/commands/traefik.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ def stop
docker :container, :stop, "traefik"
end

def start_or_run
combine start, run, by: "||"
end

def info
docker :ps, "--filter", "name=^traefik$"
end
Expand Down
16 changes: 15 additions & 1 deletion test/integration/traefik_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
require_relative "integration_test"

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
assert_traefik_running

Expand Down

0 comments on commit dda7099

Please sign in to comment.