Module: Karafka::Pro::Cli::Topics::Extension

Included in:
Cli::Topics
Defined in:
lib/karafka/pro/cli/topics.rb

Overview

Extends the base topics command to add health action support

Instance Method Summary collapse

Instance Method Details

#call(action = "help") ⇒ Object

Parameters:

  • action (String) (defaults to: "help")

    action we want to take



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/karafka/pro/cli/topics.rb', line 40

def call(action = "help")
  if action == "health"
    detailed_exit_code = options.fetch(:detailed_exitcode, false)
    issues_found = Pro::Cli::Topics::Health.new.call

    return unless detailed_exit_code

    # Exit with code 2 if issues found, code 0 if all healthy
    issues_found ? exit(2) : exit(0)
  else
    super
  end
end