Sha256: aa6148a2ca9546b0a67af727885894b646680ab598ff71e69ccd61c97360f2b1

Contents?: true

Size: 1006 Bytes

Versions: 1

Compression:

Stored size: 1006 Bytes

Contents

require_relative 'services_helper'

module Kontena::Cli::Services
  class ContainersCommand < Clamp::Command
    include Kontena::Cli::Common
    include Kontena::Cli::GridOptions
    include ServicesHelper

    parameter "NAME", "Service name"

    def execute
      require_api_url
      token = require_token

      result = client(token).get("services/#{current_grid}/#{name}/containers")
      result['containers'].each do |container|
        puts "#{container['id']}:"
        puts "  rev: #{container['deploy_rev']}"
        puts "  node: #{container['node']['name']}"
        puts "  dns: #{container['name']}.#{current_grid}.kontena.local"
        puts "  ip: #{container['overlay_cidr'].split('/')[0]}"
        puts "  public ip: #{container['node']['public_ip']}"
        if container['status'] == 'unknown'
          puts "  status: #{container['status'].colorize(:yellow)}"
        else
          puts "  status: #{container['status']}"
        end
        puts ""
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kontena-cli-0.12.0 lib/kontena/cli/services/containers_command.rb