Sha256: 285d13d7b6c6e8094ca153a4e63960ab40fdb2e5d8ed99a910685f50d4542b6f

Contents?: true

Size: 615 Bytes

Versions: 29

Compression:

Stored size: 615 Bytes

Contents

module Kontena::Cli::Vault
  class ExportCommand < Kontena::Command
    include Kontena::Cli::Common
    include Kontena::Cli::GridOptions

    banner "Exports secrets from Vault to STDOUT as YAML or JSON."

    requires_current_master

    option '--json', :flag, "Output JSON"

    def execute
      require 'shellwords'
      meth = json? ? :to_json : :to_yaml
      puts Hash[
        *Kontena.run('vault ls --return', returning: :result).sort.flat_map do |secret|
          [secret, Kontena.run("vault read --return #{secret.shellescape}", returning: :result)]
        end
      ].send(meth)
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
kontena-cli-1.2.2 lib/kontena/cli/vault/export_command.rb
kontena-cli-1.2.2.rc2 lib/kontena/cli/vault/export_command.rb
kontena-cli-1.2.2.rc1 lib/kontena/cli/vault/export_command.rb
kontena-cli-1.2.1 lib/kontena/cli/vault/export_command.rb
kontena-cli-1.2.1.rc1 lib/kontena/cli/vault/export_command.rb
kontena-cli-1.2.0 lib/kontena/cli/vault/export_command.rb
kontena-cli-1.2.0.rc3 lib/kontena/cli/vault/export_command.rb
kontena-cli-1.2.0.rc2 lib/kontena/cli/vault/export_command.rb
kontena-cli-1.2.0.rc1 lib/kontena/cli/vault/export_command.rb
kontena-cli-1.2.0.pre3 lib/kontena/cli/vault/export_command.rb
kontena-cli-1.2.0.pre2 lib/kontena/cli/vault/export_command.rb
kontena-cli-1.1.6 lib/kontena/cli/vault/export_command.rb
kontena-cli-1.2.0.pre1 lib/kontena/cli/vault/export_command.rb
kontena-cli-1.1.5 lib/kontena/cli/vault/export_command.rb
kontena-cli-1.1.5.rc3 lib/kontena/cli/vault/export_command.rb
kontena-cli-1.1.5.rc2 lib/kontena/cli/vault/export_command.rb
kontena-cli-1.1.5.rc1 lib/kontena/cli/vault/export_command.rb
kontena-cli-1.1.4 lib/kontena/cli/vault/export_command.rb
kontena-cli-1.2.0.dev1 lib/kontena/cli/vault/export_command.rb
kontena-cli-1.1.3 lib/kontena/cli/vault/export_command.rb