Sha256: a24437efac0d232234d9d33e7bcb625988fc8cedb0b0a323de64e7ab0c42a4a4

Contents?: true

Size: 760 Bytes

Versions: 16

Compression:

Stored size: 760 Bytes

Contents

require_relative '../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

16 entries across 16 versions & 1 rubygems

Version Path
kontena-cli-1.1.6 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.1.5 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.1.5.rc3 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.1.5.rc2 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.1.5.rc1 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.1.4 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.1.3 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.1.2 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.1.2.rc2 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.1.2.rc1 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.1.1 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.1.1.rc1 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.1.0 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.1.0.rc2 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.1.0.rc1 lib/kontena/cli/nodes/health_command.rb
kontena-cli-1.1.0.pre1 lib/kontena/cli/nodes/health_command.rb