lib/beaker/options/parser.rb
# Parses ARGV or provided arguments array, file options, hosts options and combines with environment variables and
# preset defaults to generate a Hash representing the Beaker options for a given test run
#
# Order of priority is as follows:
#   1.  environment variables are given top priority
#   2.  host file options
#   3.  the 'CONFIG' section of the hosts file
#   4.  ARGV or provided arguments array
#   5.  options file values
#   6.  default or preset values are given the lowest priority
#
# @param [Array] args ARGV or a provided arguments array
# @raise [ArgumentError] Raises error on bad input
Parses ARGV or provided arguments array, file options, hosts options and combines with environment variables and
preset defaults to generate a Hash representing the Beaker options for a given test run

Order of priority is as follows:
1.  environment variables are given top priority
2.  host file options
3.  the 'CONFIG' section of the hosts file
4.  ARGV or provided arguments array
5.  options file values
6.  default or preset values are given the lowest priority
Parses ARGV or provided arguments array file options hosts options and combines with environment variables and preset defaults to generate a Hash representing the Beaker options for a given test run Order of priority is as follows : 1 . environment variables are given top priority 2 . host file options 3 . the ' CONFIG ' section of the hosts file 4 . ARGV or provided arguments array 5 . options file values 6 . default or preset values are given the lowest priority
def parse_args(args = ARGV)
         Will use env, then hosts/config file, then command line, then file options
        @options = Beaker::Options::Presets.presets
        cmd_line_options = @command_line_parser.parse!(args)
        file_options = Beaker::Options::OptionsFileParser.parse_options_file(cmd_line_options[:options_file])
         merge together command line and file_options
           overwrite file options with command line options
        cmd_line_and_file_options = file_options.merge(cmd_line_options)
         merge command line and file options with defaults
           overwrite defaults with command line and file options 
        @options = @options.merge(cmd_line_and_file_options)
        read the hosts file that contains the node configuration and hypervisor info
        hosts_options = Beaker::Options::HostsFileParser.parse_hosts_file(@options[:hosts_file])
         merge in host file vars
           overwrite options (default, file options, command line, env) with host file options
        @options = @options.merge(hosts_options)
         merge in env vars
           overwrite options (default, file options, command line, hosts file) with env
        env_vars = Beaker::Options::Presets.env_vars
        @options = @options.merge(env_vars)
        if @options.is_pe?
          @options['pe_ver']           = Beaker::Options::PEVersionScraper.load_pe_version(@options[:pe_dir], @options[:pe_version_file])
          @options['pe_ver_win']       = Beaker::Options::PEVersionScraper.load_pe_version(@options[:pe_dir], @options[:pe_version_file_win])
        else
          @options['puppet_ver']       = @options[:puppet]
          @options['facter_ver']       = @options[:facter]
          @options['hiera_ver']        = @options[:hiera]
          @options['hiera_puppet_ver'] = @options[:hiera_puppet]
        end
        normalize_args
        @options
      end
def parse_args ( args = ARGV ) @options = Beaker :: Options :: Presets . presets cmd_line_options = @command_line_parser . parse! ( args ) file_options = Beaker :: Options :: OptionsFileParser . parse_options_file ( cmd_line_options [ :options_file ] ) cmd_line_and_file_options = file_options . merge ( cmd_line_options ) @options = @options . merge ( cmd_line_and_file_options ) hosts_options = Beaker :: Options :: HostsFileParser . parse_hosts_file ( @options [ :hosts_file ] ) @options = @options . merge ( hosts_options ) env_vars = Beaker :: Options :: Presets . env_vars @options = @options . merge ( env_vars ) if @options . is_pe? @options [ 'pe_ver' ] = Beaker :: Options :: PEVersionScraper . load_pe_version ( @options [ :pe_dir ] , @options [ :pe_version_file ] ) @options [ 'pe_ver_win' ] = Beaker :: Options :: PEVersionScraper . load_pe_version ( @options [ :pe_dir ] , @options [ :pe_version_file_win ] ) else @options [ 'puppet_ver' ] = @options [ :puppet ] @options [ 'facter_ver' ] = @options [ :facter ] @options [ 'hiera_ver' ] = @options [ :hiera ] @options [ 'hiera_puppet_ver' ] = @options [ :hiera_puppet ] end normalize_args @options end
Parses ARGV or provided arguments array, file options, hosts options and combines with environment variables and
preset defaults to generate a Hash representing the Beaker options for a given test run
Parses ARGV or provided arguments array file options hosts options and combines with environment variables and preset defaults to generate a Hash representing the Beaker options for a given test run
#NOTE on argument precedence: # # Will use env, then hosts/config file, then command line, then file options #  # merge together command line and file_options #   overwrite file options with command line options # merge command line and file options with defaults #   overwrite defaults with command line and file options  #read the hosts file that contains the node configuration and hypervisor info # merge in host file vars #   overwrite options (default, file options, command line, env) with host file options # merge in env vars #   overwrite options (default, file options, command line, hosts file) with env
[ArgumentError] Raises error on bad input
[ ArgumentError ] Raises error on bad input
args
<not_specific>
<not_specific>
args ARGV or a provided arguments array
args ARGV or a provided arguments array