Module: OpsWorks::CLI::Subcommands::Config
- Included in:
- Agent
- Defined in:
- lib/opsworks/cli/subcommands/config.rb
Class Method Summary collapse
-
.included(thor) ⇒ Object
rubocop:disable MethodLength rubocop:disable CyclomaticComplexity.
Class Method Details
.included(thor) ⇒ Object
rubocop:disable MethodLength rubocop:disable CyclomaticComplexity
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/opsworks/cli/subcommands/config.rb', line 10 def self.included(thor) thor.class_eval do desc 'config:get KEY [--stack STACK]', 'Get a single config value' option :stack, type: :array define_method 'config:get' do |key| fetch_credentials unless env_credentials? table = parse_stacks().map do |stack| value = stack.custom_json_at(key) [stack.name, value || '(null)'] end table.compact! table.sort! { |x, y| x.first <=> y.first } print_table table end desc 'config:set KEY VALUE [--stack STACK]', 'Set a config value' option :stack, type: :array define_method 'config:set' do |key, value| fetch_credentials unless env_credentials? parse_stacks().each do |stack| say "Updating #{stack.name}..." stack.set_custom_json_at(key, typecast_string_argument(value)) end end desc 'config:unset KEY [--stack STACK]', 'Unset a config value' option :stack, type: :array define_method 'config:unset' do |key| fetch_credentials unless env_credentials? parse_stacks().map do |stack| say "Updating #{stack.name}..." stack.set_custom_json_at(key, nil) end end end end |