Sha256: ff78ada0b5a933e3ba139e81063d0b94aab613e6d6c19038a8f8903f501b14dd

Contents?: true

Size: 772 Bytes

Versions: 24

Compression:

Stored size: 772 Bytes

Contents

module Kontena::Cli::Vault
  class UpdateCommand < Kontena::Command
    include Kontena::Cli::Common

    parameter 'NAME', 'Secret name'
    parameter '[VALUE]', 'Secret value'
    option ['-u', '--upsert'], :flag, 'Create secret unless already exists', default: false

    def execute
      require_api_url
      require_current_grid

      token = require_token
      secret = value
      if secret.to_s == ''
        secret = STDIN.read
      end
      exit_with_error('No value provided') if secret.to_s == ''
      data = {
        name: name,
        value: secret,
        upsert: upsert?
      }
      spinner "Updating #{name.colorize(:cyan)} value in the vault " do
        client(token).put("secrets/#{current_grid}/#{name}", data)
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
kontena-cli-1.0.6 lib/kontena/cli/vault/update_command.rb
kontena-cli-1.0.6.rc1 lib/kontena/cli/vault/update_command.rb
kontena-cli-1.0.5 lib/kontena/cli/vault/update_command.rb
kontena-cli-1.0.5.rc1 lib/kontena/cli/vault/update_command.rb
kontena-cli-1.0.5.pre1 lib/kontena/cli/vault/update_command.rb
kontena-cli-1.0.4 lib/kontena/cli/vault/update_command.rb
kontena-cli-1.0.4.rc2 lib/kontena/cli/vault/update_command.rb
kontena-cli-1.0.4.rc1 lib/kontena/cli/vault/update_command.rb
kontena-cli-1.0.3 lib/kontena/cli/vault/update_command.rb
kontena-cli-1.0.3.rc1 lib/kontena/cli/vault/update_command.rb
kontena-cli-1.0.2 lib/kontena/cli/vault/update_command.rb
kontena-cli-1.0.2.rc2 lib/kontena/cli/vault/update_command.rb
kontena-cli-1.0.2.rc1 lib/kontena/cli/vault/update_command.rb
kontena-cli-1.0.2.pre1 lib/kontena/cli/vault/update_command.rb
kontena-cli-1.0.1 lib/kontena/cli/vault/update_command.rb
kontena-cli-1.0.1.rc3 lib/kontena/cli/vault/update_command.rb
kontena-cli-1.0.1.rc2 lib/kontena/cli/vault/update_command.rb
kontena-cli-1.0.1.rc1 lib/kontena/cli/vault/update_command.rb
kontena-cli-1.0.0 lib/kontena/cli/vault/update_command.rb
kontena-cli-1.0.0.rc2 lib/kontena/cli/vault/update_command.rb