Class: Mrsk::Cli::Healthcheck

Inherits:
Base
  • Object
show all
Defined in:
lib/mrsk/cli/healthcheck.rb

Instance Method Summary collapse

Methods inherited from Base

exit_on_failure?, #initialize

Constructor Details

This class inherits a constructor from Mrsk::Cli::Base

Instance Method Details

#performObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/mrsk/cli/healthcheck.rb', line 5

def perform
  on(MRSK.primary_host) do
    begin
      execute *MRSK.healthcheck.run
      Mrsk::Utils::HealthcheckPoller.wait_for_healthy { capture_with_info(*MRSK.healthcheck.status) }
    rescue Mrsk::Utils::HealthcheckPoller::HealthcheckError => e
      error capture_with_info(*MRSK.healthcheck.logs)
      error capture_with_pretty_json(*MRSK.healthcheck.container_health_log)
      raise
    ensure
      execute *MRSK.healthcheck.stop, raise_on_non_zero_exit: false
      execute *MRSK.healthcheck.remove, raise_on_non_zero_exit: false
    end
  end
end