lib/kontena/cli/vault/update_command.rb in kontena-cli-1.2.0.pre3 vs lib/kontena/cli/vault/update_command.rb in kontena-cli-1.2.0.rc1
- old
+ new
@@ -1,27 +1,24 @@
module Kontena::Cli::Vault
class UpdateCommand < Kontena::Command
include Kontena::Cli::Common
+ include Kontena::Cli::GridOptions
parameter 'NAME', 'Secret name'
- parameter '[VALUE]', 'Secret value'
+ parameter '[VALUE]', 'Secret value (default: STDIN)'
option ['-u', '--upsert'], :flag, 'Create secret unless already exists', default: false
option '--silent', :flag, "Reduce output verbosity"
- def execute
- require_api_url
- require_current_grid
+ requires_current_master
- token = require_token
- value ||= STDIN.read.chomp
- data = {
- name: name,
- value: value,
- upsert: upsert?
- }
+ def default_value
+ stdin_input("Enter value for secret '#{name}'", :mask)
+ end
+
+ def execute
vspinner "Updating #{name.colorize(:cyan)} value in the vault " do
- client(token).put("secrets/#{current_grid}/#{name}", data)
+ client.put("secrets/#{current_grid}/#{name}", {name: name, value: value, upsert: upsert? })
end
end
end
end