Module: Beaker::Options::Presets

Defined in:
lib/beaker/options/presets.rb

Overview

A set of functions representing the environment variables and preset argument values to be incorporated into the Beaker options Object.

Class Method Summary collapse

Class Method Details

.env_varsOptionsHash

Generates an OptionsHash of the environment variables of interest to Beaker

Currently supports:

consoleport, IS_PE, pe_dist_dir, pe_version_file, pe_version_file_win

Returns:

  • (OptionsHash)

    The supported environment variables in an OptionsHash, empty or nil environment variables are removed from the OptionsHash



15
16
17
18
19
20
21
22
23
24
# File 'lib/beaker/options/presets.rb', line 15

def self.env_vars
  h = Beaker::Options::OptionsHash.new
  h.merge({
    :consoleport => ENV['consoleport'] ? ENV['consoleport'].to_i : nil,
    :type => ENV['IS_PE'] ? 'pe' : nil,
    :pe_dir => ENV['pe_dist_dir'],
    :pe_version_file => ENV['pe_version_file'],
    :pe_version_file_win => ENV['pe_version_file'],
  }.delete_if {|key, value| value.nil? or value.empty? })
end

.presetsOptionsHash

Generates an OptionsHash of preset values for arguments supported by Beaker

Returns:

  • (OptionsHash)

    The supported arguments in an OptionsHash



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/beaker/options/presets.rb', line 29

def self.presets
  h = Beaker::Options::OptionsHash.new
  h.merge({
    :hosts_file => 'sample.cfg',
    :options_file => nil,
    :type => 'pe',
    :provision => true,
    :preserve_hosts => false,
    :root_keys => false,
    :quiet => false,
    :xml => false,
    :color => true,
    :debug => false,
    :dry_run => false,
    :timeout => 300,
    :fail_mode => nil,
    :timesync => false,
    :repo_proxy => false,
    :add_el_extras => false,
    :consoleport => 443,
    :pe_dir => '/opt/enterprise/dists',
    :pe_version_file => 'LATEST',
    :pe_version_file_win => 'LATEST-win',
    :dot_fog => File.join(ENV['HOME'], '.fog'),
    :ec2_yaml => 'config/image_templates/ec2.yaml',
    :help => false,
    :ssh => {
      :config                => false,
      :paranoid              => false,
      :timeout               => 300,
      :auth_methods          => ["publickey"],
      :port                  => 22,
      :forward_agent         => true,
      :keys                  => ["#{ENV['HOME']}/.ssh/id_rsa"],
      :user_known_hosts_file => "#{ENV['HOME']}/.ssh/known_hosts",
    }
  })
end