Sha256: c614d9ac446ecfce48a3dbea26c45d455f2ece3346c54f94bd202c643fd994a0
Contents?: true
Size: 1.02 KB
Versions: 77
Compression:
Stored size: 1.02 KB
Contents
require_relative 'common' module Kontena::Cli::Etcd class ListCommand < Kontena::Command include Kontena::Cli::Common include Kontena::Cli::GridOptions include Common parameter "[KEY]", "Etcd key", default: '/' option ['-r', '--recursive'], :flag, "List keys recursively", default: false # the command outputs id info only anyway, this is here strictly for ignoring purposes option ['-q', '--quiet'], :flag, "Output the identifying column only", hidden: true requires_current_master requires_current_master_token def execute validate_key response = spin_if(!quiet?, "Retrieving keys from etcd") do client.get("etcd/#{current_grid}/#{key}#{'?recursive=true' if recursive?}") end if response['children'] children = response['children'].map{|c| c['key'] } puts children.join("\n") elsif response['value'] exit_with_error "Not a directory" elsif response['error'] exit_with_error response['error'] end end end end
Version data entries
77 entries across 77 versions & 2 rubygems