lib/bolt/config.rb
# Transforms CLI options into a config hash that can be merged with
# default and loaded config.
Transforms CLI options into a config hash that can be merged with
default and loaded config.
Transforms CLI options into a config hash that can be merged with default and loaded config .
def normalize_overrides(options)
      opts = options.transform_keys(&:to_s)
      overrides = opts.slice(*OPTIONS.keys, 'inventoryfile', 'transport')
      TRANSPORT_CONFIG.each do |transport, config|
        overrides[transport] = opts.slice(*config.options)
      end
      overrides['trace'] = opts['trace'] if opts.key?('trace')
      schema = {
        type:        Hash,
        properties:  CLI_OPTIONS.map { |opt| [opt, _ref: opt] }.to_h,
        definitions: OPTIONS.merge(INVENTORY_OPTIONS)
      }
      Bolt::Validator.new.validate(overrides.slice(*CLI_OPTIONS), schema, 'command line')
      overrides
    end
def normalize_overrides ( options ) opts = options . transform_keys ( & :to_s ) overrides = opts . slice ( * OPTIONS . keys , 'inventoryfile' , 'transport' ) TRANSPORT_CONFIG . each do | transport , config | overrides [ transport ] = opts . slice ( * config . options ) end overrides [ 'trace' ] = opts [ 'trace' ] if opts . key? ( 'trace' ) schema = { type : Hash , properties : CLI_OPTIONS . map { | opt | [ opt , _ref : opt ] } . to_h , definitions : OPTIONS . merge ( INVENTORY_OPTIONS ) } Bolt :: Validator . new . validate ( overrides . slice ( * CLI_OPTIONS ) , schema , 'command line' ) overrides end
Transforms CLI options into a config hash that can be merged with
default and loaded config.
Transforms CLI options into a config hash that can be merged with default and loaded config .
# Pull out config options. We need to add 'transport' and 'inventoryfile' as they're # not part of the OPTIONS hash but are valid options that can be set with CLI options # Pull out transport config options # Validate the overrides that can have arbitrary values
options
<not_specific>