Sha256: 381c02eef8843f3bf13a7eda93190735ada2edc7ed0eaa12c5384061c8eb2a4c

Contents?: true

Size: 598 Bytes

Versions: 5

Compression:

Stored size: 598 Bytes

Contents

require_relative 'common'

module Kontena::Cli::Etcd
  class GetCommand < Kontena::Command
    include Kontena::Cli::Common
    include Kontena::Cli::GridOptions
    include Common

    parameter "KEY", "Etcd key"

    def execute
      require_api_url
      token = require_token
      validate_key

      response = client(token).get("etcd/#{current_grid}/#{key}")
      if response['value']
        puts response['value']
      elsif response['children']
        abort "Cannot get value from a directory"
      elsif response['error']
        abort response['error']
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kontena-cli-0.16.0.pre5 lib/kontena/cli/etcd/get_command.rb
kontena-cli-0.16.0.pre4 lib/kontena/cli/etcd/get_command.rb
kontena-cli-0.16.0.pre3 lib/kontena/cli/etcd/get_command.rb
kontena-cli-0.16.0.pre2 lib/kontena/cli/etcd/get_command.rb
kontena-cli-0.16.0.pre1 lib/kontena/cli/etcd/get_command.rb