Sha256: 117b28ff3cacb132796f76761437e3fd318bf63d7b2c98d98c17dddf7bd03ad0

Contents?: true

Size: 760 Bytes

Versions: 32

Compression:

Stored size: 760 Bytes

Contents

require 'kontena/cli/helpers/health_helper'

module Kontena::Cli::Nodes
  class HealthCommand < Kontena::Command
    include Kontena::Cli::Common
    include Kontena::Cli::GridOptions
    include Kontena::Cli::Helpers::HealthHelper

    parameter "NODE_ID", "Node id"

    def execute
      require_api_url
      require_current_grid
      token = require_token

      node = client(token).get("nodes/#{current_grid}/#{node_id}")

      return show_node_health(node)
    end

    # @return [Boolean] true if healthy
    def show_node_health(node)
      if node['connected']
        puts "#{health_icon(:ok)} Node is online"
        return true
      else
        puts "#{health_icon(:offline)} Node is offline"
        return false
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
kontena-cli-1.3.5 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.3.5.rc1 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.3.4 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.3.4.rc1 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.3.3 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.3.3.rc1 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.3.2 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.3.2.rc2 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.3.2.rc1 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.3.1 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.3.1.rc2 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.3.1.rc1 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.3.0 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.3.0.rc4 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.3.0.rc3 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.3.0.rc2 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.3.0.rc1 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.3.0.pre2 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.3.0.pre1 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.2.2 lib/kontena/cli/nodes/health_command.rb