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

Returns:

  • (OptionsHash)

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



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
46
47
48
49
50
51
# File 'lib/beaker/options/presets.rb', line 11

def self.env_vars
  h = Beaker::Options::OptionsHash.new
  consoleport = ENV['BEAKER_CONSOLEPORT'] || ENV['consoleport']
  h.merge({
    :home                => ENV['HOME'],
    :project             => ENV['BEAKER_PROJECT'] || ENV['BEAKER_project'],
    :department          => ENV['BEAKER_DEPARTMENT'] || ENV['BEAKER_department'],
    :jenkins_build_url   => ENV['BEAKER_BUILD_URL'] || ENV['BUILD_URL'],
    :release_apt_repo_url=> ENV['BEAKER_RELEASE_APT_REPO'] || ENV['RELEASE_APT_REPO'] || "http://apt.puppetlabs.com",
    :release_yum_repo_url=> ENV['BEAKER_RELEASE_YUM_REPO'] || ENV['RELEASE_YUM_REPO'] || "http://yum.puppetlabs.com",
    :dev_builds_url      => ENV['BEAKER_DEV_BUILDS_URL'] || ENV['DEV_BUILDS_URL'] || "http://builds.puppetlabs.lan",
    :consoleport         => consoleport ? consoleport.to_i : nil,
    :type                => (ENV['BEAKER_IS_PE'] || ENV['IS_PE']) ? 'pe' : nil,
    :pe_dir              => ENV['BEAKER_PE_DIR'] || ENV['pe_dist_dir'],
    :pe_version_file     => ENV['BEAKER_PE_VERSION_FILE'] || ENV['pe_version_file'],
    :pe_version_file_win => ENV['BEAKER_PE_VERSION_FILE'] || ENV['pe_version_file'],
    :pe_ver              => ENV['BEAKER_PE_VER'] || ENV['pe_ver'],
    :forge_host          => ENV['BEAKER_FORGE_HOST'] || ENV['forge_host'],
    :answers             => {
                              :q_puppet_enterpriseconsole_auth_user_email =>
                                ENV['q_puppet_enterpriseconsole_auth_user_email'] || '[email protected]',
                              :q_puppet_enterpriseconsole_auth_password =>
                                ENV['q_puppet_enterpriseconsole_auth_password'] || '~!@#$%^*-/ aZ',
                              :q_puppet_enterpriseconsole_smtp_host =>
                                ENV['q_puppet_enterpriseconsole_smtp_host'],
                              :q_puppet_enterpriseconsole_smtp_port =>
                                ENV['q_puppet_enterpriseconsole_smtp_port'] || 25,
                              :q_puppet_enterpriseconsole_smtp_username =>
                                ENV['q_puppet_enterpriseconsole_smtp_username'],
                              :q_puppet_enterpriseconsole_smtp_password =>
                                ENV['q_puppet_enterpriseconsole_smtp_password'],
                              :q_puppet_enterpriseconsole_smtp_use_tls =>
                                ENV['q_puppet_enterpriseconsole_smtp_use_tls'] || 'n',
                              :q_verify_packages =>
                                ENV['q_verify_packages'] || 'y',
                              :q_puppetdb_password =>
                                ENV['q_puppetdb_password'] || '~!@#$%^*-/ aZ',
                            },
    :package_proxy        => ENV['BEAKER_PACKAGE_PROXY']
  }.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



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/beaker/options/presets.rb', line 56

def self.presets
  h = Beaker::Options::OptionsHash.new
  h.merge({
    :project             => 'Beaker',
    :department          => ENV['USER'] || ENV['USERNAME'] || 'unknown',
    :validate            => true,
    :jenkins_build_url   => nil,
    :forge_host          => 'vulcan-acceptance.delivery.puppetlabs.net',
    :log_level           => 'verbose',
    :trace_limit         => 10,
    :hosts_file          => 'sample.cfg',
    :options_file        => nil,
    :type                => 'pe',
    :provision           => true,
    :preserve_hosts      => 'never',
    :root_keys           => false,
    :quiet               => false,
    :project_root        => File.expand_path(File.join(File.dirname(__FILE__), "../")),
    :xml_dir             => 'junit',
    :xml_file            => 'beaker_junit.xml',
    :xml_stylesheet      => 'junit.xsl',
    :log_dir             => 'log',
    :color               => true,
    :dry_run             => false,
    :timeout             => 300,
    :fail_mode           => 'slow',
    :timesync            => false,
    :repo_proxy          => false,
    :package_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