beaker 2.18.3 → 2.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/HISTORY.md +439 -2
- data/acceptance/lib/beaker/acceptance/install_utils.rb +58 -0
- data/acceptance/pre_suite/puppet_git/install.rb +6 -65
- data/acceptance/tests/foss_utils/clone_git_repo_on.rb +49 -0
- data/beaker.gemspec +2 -0
- data/lib/beaker/dsl/helpers/web_helpers.rb +2 -1
- data/lib/beaker/dsl/install_utils/aio_defaults.rb +0 -2
- data/lib/beaker/dsl/install_utils/foss_utils.rb +97 -60
- data/lib/beaker/dsl/install_utils/pe_utils.rb +30 -53
- data/lib/beaker/dsl/install_utils/puppet_utils.rb +43 -0
- data/lib/beaker/dsl/install_utils/windows_utils.rb +144 -0
- data/lib/beaker/dsl/roles.rb +20 -3
- data/lib/beaker/dsl/structure.rb +14 -3
- data/lib/beaker/host.rb +24 -3
- data/lib/beaker/host/unix/pkg.rb +9 -0
- data/lib/beaker/host/windows/exec.rb +3 -0
- data/lib/beaker/host_prebuilt_steps.rb +5 -9
- data/lib/beaker/hypervisor/aws_sdk.rb +22 -18
- data/lib/beaker/hypervisor/docker.rb +7 -0
- data/lib/beaker/hypervisor/vmpooler.rb +4 -0
- data/lib/beaker/logger.rb +12 -1
- data/lib/beaker/options/command_line_parser.rb +9 -0
- data/lib/beaker/options/options_hash.rb +3 -296
- data/lib/beaker/options/parser.rb +12 -0
- data/lib/beaker/options/presets.rb +0 -1
- data/lib/beaker/ssh_connection.rb +48 -23
- data/lib/beaker/test_case.rb +1 -1
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/dsl/helpers/web_helpers_spec.rb +10 -1
- data/spec/beaker/dsl/install_utils/foss_utils_spec.rb +194 -49
- data/spec/beaker/dsl/install_utils/pe_utils_spec.rb +112 -22
- data/spec/beaker/dsl/install_utils/puppet_utils_spec.rb +57 -0
- data/spec/beaker/dsl/install_utils/windows_utils_spec.rb +132 -0
- data/spec/beaker/dsl/roles_spec.rb +36 -5
- data/spec/beaker/dsl/structure_spec.rb +9 -2
- data/spec/beaker/host/unix/pkg_spec.rb +26 -6
- data/spec/beaker/host_prebuilt_steps_spec.rb +3 -2
- data/spec/beaker/host_spec.rb +18 -0
- data/spec/beaker/hypervisor/aixer_spec.rb +1 -1
- data/spec/beaker/hypervisor/aws_sdk_spec.rb +595 -58
- data/spec/beaker/hypervisor/docker_spec.rb +2 -1
- data/spec/beaker/hypervisor/solaris_spec.rb +1 -0
- data/spec/beaker/hypervisor/vagrant_spec.rb +2 -1
- data/spec/beaker/logger_spec.rb +39 -0
- data/spec/beaker/options/command_line_parser_spec.rb +2 -2
- data/spec/beaker/options/options_hash_spec.rb +1 -102
- data/spec/beaker/options/parser_spec.rb +19 -0
- data/spec/beaker/options/pe_version_scaper_spec.rb +11 -1
- data/spec/beaker/options/presets_spec.rb +8 -0
- data/spec/beaker/ssh_connection_spec.rb +39 -21
- data/spec/helpers.rb +9 -3
- data/spec/mocks.rb +2 -0
- metadata +34 -11
- data/lib/beaker/answers.rb +0 -143
- data/lib/beaker/answers/version20.rb +0 -120
- data/lib/beaker/answers/version28.rb +0 -121
- data/lib/beaker/answers/version30.rb +0 -227
- data/lib/beaker/answers/version32.rb +0 -44
- data/lib/beaker/answers/version34.rb +0 -51
- data/lib/beaker/answers/version38.rb +0 -29
- data/lib/beaker/answers/version40.rb +0 -44
- data/spec/beaker/answers_spec.rb +0 -547
@@ -1,227 +0,0 @@
|
|
1
|
-
module Beaker
|
2
|
-
# This class provides answer file information for PE version 3.x
|
3
|
-
#
|
4
|
-
# @api private
|
5
|
-
class Version30 < Answers
|
6
|
-
# Return answer data for a host
|
7
|
-
#
|
8
|
-
# @param [Beaker::Host] host Host to return data for
|
9
|
-
# @param [Beaker::Host] master Host object representing the master
|
10
|
-
# @param [Beaker::Host] dashboard Host object representing the dashboard
|
11
|
-
# @param [Hash] options options for answer files
|
12
|
-
# @option options [Symbol] :type Should be one of :upgrade or :install.
|
13
|
-
# @return [Hash] A hash (keyed from hosts) containing hashes of answer file
|
14
|
-
# data.
|
15
|
-
def host_answers(host, master, database, dashboard, options)
|
16
|
-
# Windows hosts don't have normal answers...
|
17
|
-
return nil if host['platform'] =~ /windows/
|
18
|
-
masterless = options[:masterless]
|
19
|
-
|
20
|
-
# Everything's an agent
|
21
|
-
agent_a = {
|
22
|
-
:q_puppetagent_install => answer_for(options, :q_puppetagent_install, 'y'),
|
23
|
-
:q_puppet_cloud_install => answer_for(options, :q_puppet_cloud_install, 'y'),
|
24
|
-
:q_verify_packages => answer_for(options, :q_verify_packages, 'y'),
|
25
|
-
:q_puppet_symlinks_install => answer_for(options, :q_puppet_symlinks_install, 'y'),
|
26
|
-
:q_puppetagent_certname => answer_for(options, :q_puppetagent_certname, host.to_s),
|
27
|
-
|
28
|
-
# Disable database, console, and master by default
|
29
|
-
# This will be overridden by other blocks being merged in.
|
30
|
-
:q_puppetmaster_install => answer_for(options, :q_puppetmaster_install, 'n'),
|
31
|
-
:q_all_in_one_install => answer_for(options, :q_all_in_one_install, 'n'),
|
32
|
-
:q_puppet_enterpriseconsole_install => answer_for(options, :q_puppet_enterpriseconsole_install, 'n'),
|
33
|
-
:q_puppetdb_install => answer_for(options, :q_puppetdb_install, 'n'),
|
34
|
-
:q_database_install => answer_for(options, :q_database_install, 'n'),
|
35
|
-
}
|
36
|
-
agent_a[:q_puppetagent_server] = masterless ? host.to_s : master.to_s
|
37
|
-
agent_a[:q_continue_or_reenter_master_hostname] = 'c' if masterless
|
38
|
-
|
39
|
-
# These base answers are needed by all
|
40
|
-
common_a = {
|
41
|
-
:q_install => answer_for(options, :q_install, 'y'),
|
42
|
-
:q_vendor_packages_install => answer_for(options, :q_vendor_packages_install, 'y'),
|
43
|
-
}
|
44
|
-
|
45
|
-
unless masterless
|
46
|
-
# master/database answers
|
47
|
-
master_database_a = {
|
48
|
-
:q_puppetmaster_certname => answer_for(options, :q_puppetmaster_certname, master.to_s)
|
49
|
-
}
|
50
|
-
|
51
|
-
# Master/dashboard answers
|
52
|
-
master_console_a = {
|
53
|
-
:q_puppetdb_hostname => answer_for(options, :q_puppetdb_hostname, database.to_s),
|
54
|
-
:q_puppetdb_port => answer_for(options, :q_puppetdb_port, 8081)
|
55
|
-
}
|
56
|
-
|
57
|
-
# Master only answers
|
58
|
-
master_dns_altnames = [master.to_s, master['ip'], 'puppet'].compact.uniq.join(',')
|
59
|
-
master_a = {
|
60
|
-
:q_puppetmaster_install => answer_for(options, :q_puppetmaster_install, 'y'),
|
61
|
-
:q_puppetmaster_dnsaltnames => master_dns_altnames,
|
62
|
-
:q_puppetmaster_enterpriseconsole_hostname => answer_for(options, :q_puppetmaster_enterpriseconsole_hostname, dashboard.to_s),
|
63
|
-
:q_puppetmaster_enterpriseconsole_port => answer_for(options, :q_puppetmaster_enterpriseconsole_port, 443),
|
64
|
-
}
|
65
|
-
|
66
|
-
# Common answers for console and database
|
67
|
-
console_auth_password = "'#{answer_for(options, :q_puppet_enterpriseconsole_auth_password)}'"
|
68
|
-
puppetdb_database_name = answer_for(options, :q_puppetdb_database_name, 'pe-puppetdb')
|
69
|
-
puppetdb_database_user = answer_for(options, :q_puppetdb_database_user, 'mYpdBu3r')
|
70
|
-
puppetdb_database_password = answer_for(options, :q_puppetdb_database_password, "'#{answer_for(options, :q_puppetdb_password)}'")
|
71
|
-
console_auth_database_name = answer_for(options, :q_puppet_enterpriseconsole_auth_database_name, 'console_auth')
|
72
|
-
console_auth_database_user = answer_for(options, :q_puppet_enterpriseconsole_auth_database_user, 'mYu7hu3r')
|
73
|
-
console_auth_database_password = answer_for(options, :q_puppet_enterpriseconsole_auth_database_password, console_auth_password)
|
74
|
-
console_database_name = answer_for(options, :q_puppet_enterpriseconsole_database_name, 'console')
|
75
|
-
console_database_user = answer_for(options, :q_puppet_enterpriseconsole_database_user, 'mYc0nS03u3r')
|
76
|
-
console_database_host = answer_for(options, :q_database_host, database.to_s)
|
77
|
-
console_database_port = answer_for(options, :q_database_port, 5432)
|
78
|
-
console_database_password = answer_for(options, :q_puppet_enterpriseconsole_database_password, console_auth_password)
|
79
|
-
|
80
|
-
console_database_a = {
|
81
|
-
:q_puppetdb_database_name => puppetdb_database_name,
|
82
|
-
:q_puppetdb_database_user => puppetdb_database_user,
|
83
|
-
:q_puppetdb_database_password => puppetdb_database_password,
|
84
|
-
:q_puppet_enterpriseconsole_auth_database_name => console_auth_database_name,
|
85
|
-
:q_puppet_enterpriseconsole_auth_database_user => console_auth_database_user,
|
86
|
-
:q_puppet_enterpriseconsole_auth_database_password => console_auth_database_password,
|
87
|
-
:q_puppet_enterpriseconsole_database_name => console_database_name,
|
88
|
-
:q_puppet_enterpriseconsole_database_user => console_database_user,
|
89
|
-
:q_puppet_enterpriseconsole_database_password => console_database_password,
|
90
|
-
:q_database_host => console_database_host,
|
91
|
-
:q_database_port => console_database_port,
|
92
|
-
}
|
93
|
-
|
94
|
-
# Console only answers
|
95
|
-
dashboard_user = "'#{answer_for(options, :q_puppet_enterpriseconsole_auth_user_email)}'"
|
96
|
-
|
97
|
-
|
98
|
-
console_install = answer_for(options, :q_puppet_enterpriseconsole_install, 'y')
|
99
|
-
console_inventory_hostname = answer_for(options, :q_puppet_enterpriseconsole_inventory_hostname, host.to_s)
|
100
|
-
console_inventory_certname = answer_for(options, :q_puppet_enterpriseconsole_inventory_certname, host.to_s)
|
101
|
-
console_inventory_dnsaltnames = answer_for(options, :q_puppet_enterpriseconsole_inventory_dnsaltnames, dashboard.to_s)
|
102
|
-
smtp_host = "'#{answer_for(options, :q_puppet_enterpriseconsole_smtp_host, dashboard.to_s)}'"
|
103
|
-
smtp_port = "'#{answer_for(options, :q_puppet_enterpriseconsole_smtp_port)}'"
|
104
|
-
smtp_username = answer_for(options, :q_puppet_enterpriseconsole_smtp_username)
|
105
|
-
smtp_password = answer_for(options, :q_puppet_enterpriseconsole_smtp_password)
|
106
|
-
smtp_use_tls = "'#{answer_for(options, :q_puppet_enterpriseconsole_smtp_use_tls)}'"
|
107
|
-
console_inventory_port = answer_for(options, :q_puppet_enterpriseconsole_inventory_port, 8140)
|
108
|
-
master_hostname = answer_for(options, :q_puppet_enterpriseconsole_master_hostname, master.to_s)
|
109
|
-
console_httpd_port = answer_for(options, :q_puppet_enterpriseconsole_httpd_port, 443)
|
110
|
-
|
111
|
-
console_a = {
|
112
|
-
:q_puppet_enterpriseconsole_install => console_install,
|
113
|
-
:q_puppet_enterpriseconsole_inventory_hostname => console_inventory_hostname,
|
114
|
-
:q_puppet_enterpriseconsole_inventory_certname => console_inventory_certname,
|
115
|
-
:q_puppet_enterpriseconsole_inventory_dnsaltnames => console_inventory_dnsaltnames,
|
116
|
-
:q_puppet_enterpriseconsole_inventory_port => console_inventory_port,
|
117
|
-
:q_puppet_enterpriseconsole_master_hostname => master_hostname,
|
118
|
-
:q_puppet_enterpriseconsole_auth_user_email => dashboard_user,
|
119
|
-
:q_puppet_enterpriseconsole_auth_password => console_auth_password,
|
120
|
-
:q_puppet_enterpriseconsole_httpd_port => console_httpd_port,
|
121
|
-
:q_puppet_enterpriseconsole_smtp_host => smtp_host,
|
122
|
-
:q_puppet_enterpriseconsole_smtp_use_tls => smtp_use_tls,
|
123
|
-
:q_puppet_enterpriseconsole_smtp_port => smtp_port,
|
124
|
-
}
|
125
|
-
|
126
|
-
if smtp_password and smtp_username
|
127
|
-
console_smtp_user_auth = answer_for(options, :q_puppet_enterpriseconsole_smtp_user_auth, 'y')
|
128
|
-
console_a.merge!({
|
129
|
-
:q_puppet_enterpriseconsole_smtp_password => "'#{smtp_password}'",
|
130
|
-
:q_puppet_enterpriseconsole_smtp_username => "'#{smtp_username}'",
|
131
|
-
:q_puppet_enterpriseconsole_smtp_user_auth => console_smtp_user_auth
|
132
|
-
})
|
133
|
-
end
|
134
|
-
|
135
|
-
# Database only answers
|
136
|
-
database_a = {
|
137
|
-
:q_puppetdb_install => answer_for(options, :q_puppetdb_install, 'y'),
|
138
|
-
:q_database_install => answer_for(options, :q_database_install, 'y'),
|
139
|
-
:q_database_root_password => "'#{answer_for(options, :q_database_root_password, '=ZYdjiP3jCwV5eo9s1MBd')}'",
|
140
|
-
:q_database_root_user => answer_for(options, :q_database_root_user, 'pe-postgres'),
|
141
|
-
}
|
142
|
-
end
|
143
|
-
|
144
|
-
# Special answers for special hosts
|
145
|
-
aix_a = {
|
146
|
-
:q_run_updtvpkg => answer_for(options, :q_run_updtvpkg, 'y'),
|
147
|
-
}
|
148
|
-
|
149
|
-
answers = common_a.dup
|
150
|
-
|
151
|
-
unless options[:type] == :upgrade
|
152
|
-
answers.merge! agent_a
|
153
|
-
end
|
154
|
-
|
155
|
-
if host == master
|
156
|
-
answers.merge! master_console_a
|
157
|
-
unless options[:type] == :upgrade
|
158
|
-
answers.merge! master_a
|
159
|
-
answers.merge! master_database_a
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
if host == dashboard
|
164
|
-
answers.merge! master_console_a
|
165
|
-
answers.merge! console_database_a
|
166
|
-
answers[:q_pe_database] = answer_for(options, :q_pe_database, 'y')
|
167
|
-
unless options[:type] == :upgrade
|
168
|
-
answers.merge! console_a
|
169
|
-
else
|
170
|
-
answers[:q_database_export_dir] = answer_for(options, :q_database_export_dir, '/tmp')
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
if host == database
|
175
|
-
if database != master
|
176
|
-
if options[:type] == :upgrade
|
177
|
-
# This is kinda annoying - if we're upgrading to 3.0 and are
|
178
|
-
# puppetdb, we're actually doing a clean install. We thus
|
179
|
-
# need the core agent answers.
|
180
|
-
answers.merge! agent_a
|
181
|
-
end
|
182
|
-
answers.merge! master_database_a
|
183
|
-
end
|
184
|
-
answers.merge! database_a
|
185
|
-
answers.merge! console_database_a
|
186
|
-
end
|
187
|
-
|
188
|
-
if host == master and host == database and host == dashboard
|
189
|
-
answers[:q_all_in_one_install] = 'y'
|
190
|
-
end
|
191
|
-
|
192
|
-
if host['platform'].include? 'aix'
|
193
|
-
answers.merge! aix_a
|
194
|
-
end
|
195
|
-
|
196
|
-
return answers
|
197
|
-
end
|
198
|
-
|
199
|
-
# Return answer data for all hosts.
|
200
|
-
#
|
201
|
-
# @return [Hash] A hash (keyed from hosts) containing hashes of answer file
|
202
|
-
# data.
|
203
|
-
def generate_answers
|
204
|
-
the_answers = {}
|
205
|
-
masterless = @options[:masterless]
|
206
|
-
database = masterless ? nil : only_host_with_role(@hosts, 'database')
|
207
|
-
dashboard = masterless ? nil : only_host_with_role(@hosts, 'dashboard')
|
208
|
-
master = masterless ? nil : only_host_with_role(@hosts, 'master')
|
209
|
-
@hosts.each do |h|
|
210
|
-
if @options[:type] == :upgrade and h[:pe_ver] =~ /\A3.0/
|
211
|
-
# 3.0.x to 3.0.x should require no answers
|
212
|
-
the_answers[h.name] = {
|
213
|
-
:q_install => answer_for(@options, :q_install, 'y'),
|
214
|
-
:q_install_vendor_packages => answer_for(@options, :q_install_vendor_packages, 'y'),
|
215
|
-
}
|
216
|
-
else
|
217
|
-
the_answers[h.name] = host_answers(h, master, database, dashboard, @options)
|
218
|
-
end
|
219
|
-
if the_answers[h.name] && h[:custom_answers]
|
220
|
-
the_answers[h.name] = the_answers[h.name].merge(h[:custom_answers])
|
221
|
-
end
|
222
|
-
h[:answers] = the_answers[h.name]
|
223
|
-
end
|
224
|
-
return the_answers
|
225
|
-
end
|
226
|
-
end
|
227
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'beaker/answers/version30'
|
2
|
-
|
3
|
-
module Beaker
|
4
|
-
# This class provides answer file information for PE version 3.2
|
5
|
-
#
|
6
|
-
# @api private
|
7
|
-
class Version32 < Version30
|
8
|
-
# Return answer data for all hosts.
|
9
|
-
#
|
10
|
-
# @return [Hash] A hash (keyed from hosts) containing hashes of answer file
|
11
|
-
# data.
|
12
|
-
def generate_answers
|
13
|
-
masterless = @options[:masterless]
|
14
|
-
return super if masterless
|
15
|
-
|
16
|
-
dashboard = only_host_with_role(@hosts, 'dashboard')
|
17
|
-
database = only_host_with_role(@hosts, 'database')
|
18
|
-
master = only_host_with_role(@hosts, 'master')
|
19
|
-
|
20
|
-
the_answers = super
|
21
|
-
if dashboard != master
|
22
|
-
# in 3.2, dashboard needs the master certname
|
23
|
-
the_answers[dashboard.name][:q_puppetmaster_certname] = master.to_s
|
24
|
-
end
|
25
|
-
|
26
|
-
# do we want to check for updates?
|
27
|
-
pe_check_for_updates = answer_for(@options, :q_pe_check_for_updates, 'n')
|
28
|
-
the_answers[dashboard.name][:q_pe_check_for_updates] = pe_check_for_updates
|
29
|
-
the_answers[master.name][:q_pe_check_for_updates] = pe_check_for_updates
|
30
|
-
|
31
|
-
if @options[:type] == :upgrade && dashboard != database
|
32
|
-
# In a split configuration, there is no way for the upgrader
|
33
|
-
# to know how much disk space is available for the database
|
34
|
-
# migration. We tell it to continue on, because we're
|
35
|
-
# awesome.
|
36
|
-
the_answers[dashboard.name][:q_upgrade_with_unknown_disk_space] = 'y'
|
37
|
-
end
|
38
|
-
@hosts.each do |h|
|
39
|
-
h[:answers] = the_answers[h.name]
|
40
|
-
end
|
41
|
-
return the_answers
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'beaker/answers/version32'
|
2
|
-
|
3
|
-
module Beaker
|
4
|
-
# This class provides answer file information for PE version 3.4
|
5
|
-
#
|
6
|
-
# @api private
|
7
|
-
class Version34 < Version32
|
8
|
-
def generate_answers
|
9
|
-
masterless = @options[:masterless]
|
10
|
-
return super if masterless
|
11
|
-
|
12
|
-
dashboard = only_host_with_role(@hosts, 'dashboard')
|
13
|
-
database = only_host_with_role(@hosts, 'database')
|
14
|
-
|
15
|
-
the_answers = super
|
16
|
-
|
17
|
-
classifier_database_user = answer_for(@options, :q_classifier_database_user, 'DFGhjlkj')
|
18
|
-
classifier_database_name = answer_for(@options, :q_database_name, 'pe-classifier')
|
19
|
-
classifier_database_password = "'#{answer_for(@options, :q_classifier_database_password)}'"
|
20
|
-
activity_database_user = answer_for(@options, :q_activity_database_user, 'adsfglkj')
|
21
|
-
activity_database_name = answer_for(@options, :q_activity_database_name, 'pe-activity')
|
22
|
-
activity_database_password = "'#{answer_for(@options, :q_activity_database_password)}'"
|
23
|
-
rbac_database_user = answer_for(@options, :q_rbac_database_user, 'RbhNBklm')
|
24
|
-
rbac_database_name = answer_for(@options, :q_rbac_database_name, 'pe-rbac')
|
25
|
-
rbac_database_password = "'#{answer_for(@options, :q_rbac_database_password)}'"
|
26
|
-
|
27
|
-
console_services_hash = {
|
28
|
-
:q_classifier_database_user => classifier_database_user,
|
29
|
-
:q_classifier_database_name => classifier_database_name,
|
30
|
-
:q_classifier_database_password => classifier_database_password,
|
31
|
-
:q_activity_database_user => activity_database_user,
|
32
|
-
:q_activity_database_name => activity_database_name,
|
33
|
-
:q_activity_database_password => activity_database_password,
|
34
|
-
:q_rbac_database_user => rbac_database_user,
|
35
|
-
:q_rbac_database_name => rbac_database_name,
|
36
|
-
:q_rbac_database_password => rbac_database_password,
|
37
|
-
}
|
38
|
-
|
39
|
-
# If we're installing or upgrading from a non-RBAC version, set the 'admin' password
|
40
|
-
if @options[:type] == :upgrade && @options[:set_console_password]
|
41
|
-
dashboard_password = "'#{answer_for(@options, :q_puppet_enterpriseconsole_auth_password)}'"
|
42
|
-
the_answers[dashboard.name][:q_puppet_enterpriseconsole_auth_password] = dashboard_password
|
43
|
-
end
|
44
|
-
|
45
|
-
the_answers[dashboard.name].merge!(console_services_hash)
|
46
|
-
the_answers[database.name].merge!(console_services_hash)
|
47
|
-
|
48
|
-
return the_answers
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'beaker/answers/version34'
|
2
|
-
|
3
|
-
module Beaker
|
4
|
-
# This class provides answer file information for PE version 4.0
|
5
|
-
#
|
6
|
-
# @api private
|
7
|
-
class Version38 < Version34
|
8
|
-
def generate_answers
|
9
|
-
masterless = @options[:masterless]
|
10
|
-
return super if masterless
|
11
|
-
|
12
|
-
the_answers = super
|
13
|
-
|
14
|
-
# add new answers
|
15
|
-
exit_for_nc_migrate = answer_for(@options, :q_exit_for_nc_migrate, 'n')
|
16
|
-
enable_future_parser = answer_for(@options, :q_enable_future_parser, 'n')
|
17
|
-
|
18
|
-
the_answers.map do |key, value|
|
19
|
-
# there may not be answers in the case of a windows host
|
20
|
-
if the_answers[key]
|
21
|
-
the_answers[key][:q_exit_for_nc_migrate] = exit_for_nc_migrate
|
22
|
-
the_answers[key][:q_enable_future_parser] = enable_future_parser
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
return the_answers
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'beaker/answers/version38'
|
2
|
-
|
3
|
-
module Beaker
|
4
|
-
# This class provides answer file information for PE version 4.0
|
5
|
-
#
|
6
|
-
# @api private
|
7
|
-
class Version40 < Version38
|
8
|
-
def generate_answers
|
9
|
-
masterless = @options[:masterless]
|
10
|
-
return super if masterless
|
11
|
-
|
12
|
-
master = only_host_with_role(@hosts, 'master')
|
13
|
-
|
14
|
-
the_answers = super
|
15
|
-
|
16
|
-
# remove some old answers
|
17
|
-
# - q_puppet_cloud_install
|
18
|
-
# - q_puppet_enterpriseconsole_database_name
|
19
|
-
# - q_puppet_enterpriseconsole_database_password
|
20
|
-
# - q_puppet_enterpriseconsole_database_user
|
21
|
-
|
22
|
-
the_answers.map do |vm, as|
|
23
|
-
if as
|
24
|
-
as.delete_if do |key, value|
|
25
|
-
key =~ /q_puppet_cloud_install/
|
26
|
-
#to be deleted in the future
|
27
|
-
#|q_puppet_enterpriseconsole_database_name|q_puppet_enterpriseconsole_database_password|q_puppet_enterpriseconsole_database_user/
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
# add some new answers
|
33
|
-
update_server_host = answer_for(@options, :q_update_server_host, master.to_s)
|
34
|
-
install_update_server = answer_for(@options, :q_install_update_server, 'y')
|
35
|
-
|
36
|
-
the_answers.map do |key, value|
|
37
|
-
the_answers[key][:q_update_server_host] = update_server_host if the_answers[key]
|
38
|
-
end
|
39
|
-
the_answers[master.name][:q_install_update_server] = install_update_server
|
40
|
-
|
41
|
-
return the_answers
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
data/spec/beaker/answers_spec.rb
DELETED
@@ -1,547 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Beaker
|
4
|
-
describe Answers do
|
5
|
-
let( :basic_hosts ) { make_hosts( { 'pe_ver' => @ver } ) }
|
6
|
-
let( :options ) { @options || Beaker::Options::Presets.new.presets }
|
7
|
-
let( :hosts ) { basic_hosts[0]['roles'] = ['master', 'database', 'dashboard']
|
8
|
-
basic_hosts[1]['platform'] = 'windows'
|
9
|
-
basic_hosts }
|
10
|
-
let( :answers ) { Beaker::Answers.create(@ver, hosts, options) }
|
11
|
-
|
12
|
-
after :each do
|
13
|
-
ENV.delete('q_puppet_cloud_install')
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'uses options[:answers] if they are set (override q_puppet_cloud_install for 3.8' do
|
17
|
-
@ver = '3.8'
|
18
|
-
options[:answers] = Beaker::Options::OptionsHash.new
|
19
|
-
options[:answers]['q_puppet_cloud_install'] = 'n'
|
20
|
-
opts = answers.instance_variable_get(:@options)
|
21
|
-
@answers = answers.answers
|
22
|
-
# confirm that the answers were correctly added to the answers object
|
23
|
-
expect(opts).to be_a_kind_of Beaker::Options::OptionsHash
|
24
|
-
expect(opts[:answers]['q_puppet_cloud_install']).to be == 'n'
|
25
|
-
expect(opts[:answers][:q_puppet_cloud_install]).to be == 'n'
|
26
|
-
hosts.each do |host|
|
27
|
-
if @answers[host.name]
|
28
|
-
expect( @answers[host.name][:q_puppet_cloud_install] ).to be == 'n'
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'uses ENV[:q_*] if they are set (override q_puppet_cloud_install for 3.8' do
|
34
|
-
@ver = '3.8'
|
35
|
-
ENV['q_puppet_cloud_install'] = 'n'
|
36
|
-
@options = Beaker::Options::Parser.new.parse_args([])
|
37
|
-
|
38
|
-
opts = answers.instance_variable_get(:@options)
|
39
|
-
@answers = answers.answers
|
40
|
-
# confirm that the answers were correctly added to the answers object
|
41
|
-
expect(opts).to be_a_kind_of Beaker::Options::OptionsHash
|
42
|
-
expect(opts[:answers]['q_puppet_cloud_install']).to be == 'n'
|
43
|
-
expect(opts[:answers][:q_puppet_cloud_install]).to be == 'n'
|
44
|
-
hosts.each do |host|
|
45
|
-
if @answers[host.name]
|
46
|
-
expect( @answers[host.name][:q_puppet_cloud_install] ).to be == 'n'
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'generates 3.4 answers for 4.0 hosts' do
|
52
|
-
@ver = '4.0'
|
53
|
-
expect( answers ).to be_a_kind_of Version34
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'generates 4.0 answers for 3.99 hosts' do
|
57
|
-
@ver = '3.99'
|
58
|
-
expect( answers ).to be_a_kind_of Version40
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'generates 3.8 answers for 3.8 hosts' do
|
62
|
-
@ver = '3.8'
|
63
|
-
expect( answers ).to be_a_kind_of Version38
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'generates 3.4 answers for 3.4 hosts' do
|
67
|
-
@ver = '3.4'
|
68
|
-
expect( answers ).to be_a_kind_of Version34
|
69
|
-
end
|
70
|
-
|
71
|
-
it 'generates 3.2 answers for 3.3 hosts' do
|
72
|
-
@ver = '3.3'
|
73
|
-
expect( answers ).to be_a_kind_of Version32
|
74
|
-
end
|
75
|
-
|
76
|
-
it 'generates 3.2 answers for 3.2 hosts' do
|
77
|
-
@ver = '3.2'
|
78
|
-
expect( answers ).to be_a_kind_of Version32
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'generates 3.0 answers for 3.1 hosts' do
|
82
|
-
@ver = '3.1'
|
83
|
-
expect( answers ).to be_a_kind_of Version30
|
84
|
-
end
|
85
|
-
|
86
|
-
it 'generates 3.0 answers for 3.0 hosts' do
|
87
|
-
@ver = '3.0'
|
88
|
-
expect( answers ).to be_a_kind_of Version30
|
89
|
-
end
|
90
|
-
|
91
|
-
it 'generates 2.8 answers for 2.8 hosts' do
|
92
|
-
@ver = '2.8'
|
93
|
-
expect( answers ).to be_a_kind_of Version28
|
94
|
-
end
|
95
|
-
|
96
|
-
it 'generates 2.0 answers for 2.0 hosts' do
|
97
|
-
@ver = '2.0'
|
98
|
-
expect( answers ).to be_a_kind_of Version20
|
99
|
-
end
|
100
|
-
|
101
|
-
it 'raises an error for an unknown version' do
|
102
|
-
@ver = 'x.x'
|
103
|
-
expect{ answers }.to raise_error( NotImplementedError )
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
describe "Masterless Setup" do
|
108
|
-
let( :ver ) { @ver || '3.0' }
|
109
|
-
let( :options ) { options = Beaker::Options::Presets.new.presets
|
110
|
-
options[:masterless] = true
|
111
|
-
options }
|
112
|
-
let( :hosts ) { make_hosts({}, 1) }
|
113
|
-
let( :host ) { hosts[0] }
|
114
|
-
let( :answers ) { Beaker::Answers.create(ver, hosts, options) }
|
115
|
-
let( :host_answers ) { answers.answers[host.name] }
|
116
|
-
|
117
|
-
|
118
|
-
it 'adds the correct answers' do
|
119
|
-
expect( host_answers[:q_puppetagent_server] ).to be === host_answers[:q_puppetagent_certname]
|
120
|
-
expect( host_answers[:q_continue_or_reenter_master_hostname]).to be === 'c'
|
121
|
-
end
|
122
|
-
|
123
|
-
it 'skips the correct answers' do
|
124
|
-
expect( host_answers[:q_puppetmaster_install]).to be === 'n'
|
125
|
-
expect( host_answers[:q_puppet_enterpriseconsole_install] ).to be === 'n'
|
126
|
-
expect( host_answers[:q_puppetdb_install] ).to be === 'n'
|
127
|
-
end
|
128
|
-
|
129
|
-
it '3.0: never calls #only_host_with_role in #generate_answers' do
|
130
|
-
expect( answers.generate_answers ).to_not receive( :only_host_with_role )
|
131
|
-
end
|
132
|
-
|
133
|
-
it '3.2: never calls #only_host_with_role in #generate_answers' do
|
134
|
-
@ver = '3.2'
|
135
|
-
expect( answers.generate_answers ).to_not receive( :only_host_with_role )
|
136
|
-
end
|
137
|
-
|
138
|
-
it '3.4: never calls #only_host_with_role in #generate_answers' do
|
139
|
-
@ver = '3.4'
|
140
|
-
expect( answers.generate_answers ).to_not receive( :only_host_with_role )
|
141
|
-
end
|
142
|
-
|
143
|
-
end
|
144
|
-
|
145
|
-
describe Version34 do
|
146
|
-
let( :options ) { Beaker::Options::Presets.new.presets }
|
147
|
-
let( :basic_hosts ) { make_hosts( {'pe_ver' => @ver } ) }
|
148
|
-
let( :hosts ) { basic_hosts[0]['roles'] = ['master', 'agent']
|
149
|
-
basic_hosts[0][:custom_answers] = { :q_custom => 'LOOKYHERE' }
|
150
|
-
basic_hosts[1]['roles'] = ['dashboard', 'agent']
|
151
|
-
basic_hosts[2]['roles'] = ['database', 'agent']
|
152
|
-
basic_hosts }
|
153
|
-
let( :answers ) { Beaker::Answers.create(@ver, hosts, options) }
|
154
|
-
|
155
|
-
before :each do
|
156
|
-
@ver = '3.4'
|
157
|
-
@answers = answers.answers
|
158
|
-
end
|
159
|
-
|
160
|
-
it 'should add console services answers to dashboard answers' do
|
161
|
-
@ver = '3.4'
|
162
|
-
answers = @answers
|
163
|
-
expect( @answers['vm2'] ).to include :q_classifier_database_user => 'DFGhjlkj'
|
164
|
-
expect( @answers['vm2'] ).to include :q_classifier_database_name => 'pe-classifier'
|
165
|
-
expect( @answers['vm2'] ).to include :q_classifier_database_password => "'~!@\#$%^*-/ aZ'"
|
166
|
-
expect( @answers['vm2'] ).to include :q_activity_database_user => 'adsfglkj'
|
167
|
-
expect( @answers['vm2'] ).to include :q_activity_database_name => 'pe-activity'
|
168
|
-
expect( @answers['vm2'] ).to include :q_activity_database_password => "'~!@\#$%^*-/ aZ'"
|
169
|
-
expect( @answers['vm2'] ).to include :q_rbac_database_user => 'RbhNBklm'
|
170
|
-
expect( @answers['vm2'] ).to include :q_rbac_database_name => 'pe-rbac'
|
171
|
-
expect( @answers['vm2'] ).to include :q_rbac_database_password => "'~!@\#$%^*-/ aZ'"
|
172
|
-
end
|
173
|
-
|
174
|
-
it 'should add console services answers to database answers' do
|
175
|
-
@ver = '3.4'
|
176
|
-
answers = @answers
|
177
|
-
expect( @answers['vm3'] ).to include :q_classifier_database_user => 'DFGhjlkj'
|
178
|
-
expect( @answers['vm3'] ).to include :q_classifier_database_name => 'pe-classifier'
|
179
|
-
expect( @answers['vm3'] ).to include :q_classifier_database_password => "'~!@\#$%^*-/ aZ'"
|
180
|
-
expect( @answers['vm3'] ).to include :q_activity_database_user => 'adsfglkj'
|
181
|
-
expect( @answers['vm3'] ).to include :q_activity_database_name => 'pe-activity'
|
182
|
-
expect( @answers['vm3'] ).to include :q_activity_database_password => "'~!@\#$%^*-/ aZ'"
|
183
|
-
expect( @answers['vm3'] ).to include :q_rbac_database_user => 'RbhNBklm'
|
184
|
-
expect( @answers['vm3'] ).to include :q_rbac_database_name => 'pe-rbac'
|
185
|
-
expect( @answers['vm3'] ).to include :q_rbac_database_password => "'~!@\#$%^*-/ aZ'"
|
186
|
-
end
|
187
|
-
|
188
|
-
it 'should add answers to the host objects' do
|
189
|
-
@ver = '3.4'
|
190
|
-
answers = @answers
|
191
|
-
hosts.each do |host|
|
192
|
-
puts "checking #{host.name}"
|
193
|
-
expect( host[:answers] ).to be === answers[host.name]
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
it 'should add answers to the host objects' do
|
198
|
-
hosts.each do |host|
|
199
|
-
expect( host[:answers] ).to be === @answers[host.name]
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
203
|
-
it 'appends custom answers to generated answers' do
|
204
|
-
expect( hosts[0][:custom_answers] ).to be == { :q_custom => 'LOOKYHERE' }
|
205
|
-
expect( @answers['vm1'] ).to include :q_custom
|
206
|
-
expect( hosts[0][:answers] ).to include :q_custom
|
207
|
-
end
|
208
|
-
|
209
|
-
end
|
210
|
-
|
211
|
-
describe Version38 do
|
212
|
-
let( :options ) { Beaker::Options::Presets.new.presets }
|
213
|
-
let( :basic_hosts ) { make_hosts( {'pe_ver' => @ver } ) }
|
214
|
-
let( :hosts ) { basic_hosts[0]['roles'] = ['master', 'agent']
|
215
|
-
basic_hosts[1]['roles'] = ['dashboard', 'database', 'agent']
|
216
|
-
basic_hosts[2]['roles'] = ['agent']
|
217
|
-
basic_hosts[2]['platform'] = 'windows2008r2'
|
218
|
-
basic_hosts }
|
219
|
-
let( :answers ) { Beaker::Answers.create(@ver, hosts, options) }
|
220
|
-
let( :upgrade_answers ) { Beaker::Answers.create(@ver, hosts, options.merge( {:type => :upgrade}) ) }
|
221
|
-
|
222
|
-
before :each do
|
223
|
-
@ver = '3.8'
|
224
|
-
@answers = answers.answers
|
225
|
-
end
|
226
|
-
|
227
|
-
it 'should add q_pe_check_for_updates to master' do
|
228
|
-
expect( @answers['vm1'][:q_pe_check_for_updates] ).to be === 'n'
|
229
|
-
end
|
230
|
-
|
231
|
-
it 'should add q_pe_check_for_updates to dashboard' do
|
232
|
-
expect( @answers['vm2'][:q_pe_check_for_updates] ).to be === 'n'
|
233
|
-
end
|
234
|
-
|
235
|
-
it 'adds :q_enable_future_parser to all hosts, default to "n"' do
|
236
|
-
hosts.each do |host|
|
237
|
-
expect( basic_hosts[0][:answers][:q_enable_future_parser] ).to be == 'n'
|
238
|
-
expect( basic_hosts[1][:answers][:q_enable_future_parser] ).to be == 'n'
|
239
|
-
end
|
240
|
-
end
|
241
|
-
|
242
|
-
it 'adds :q_exit_for_nc_migrate to all hosts, default to "n"' do
|
243
|
-
expect( basic_hosts[0][:answers][:q_exit_for_nc_migrate] ).to be == 'n'
|
244
|
-
expect( basic_hosts[1][:answers][:q_exit_for_nc_migrate] ).to be == 'n'
|
245
|
-
end
|
246
|
-
|
247
|
-
it 'should add answers to the host objects' do
|
248
|
-
answers = @answers
|
249
|
-
hosts.each do |host|
|
250
|
-
expect( host[:answers] ).to be === @answers[host.name]
|
251
|
-
end
|
252
|
-
end
|
253
|
-
end
|
254
|
-
|
255
|
-
describe Version40 do
|
256
|
-
let( :options ) { Beaker::Options::Presets.new.presets }
|
257
|
-
let( :basic_hosts ) { make_hosts( {'pe_ver' => @ver } ) }
|
258
|
-
let( :hosts ) { basic_hosts[0]['roles'] = ['master', 'agent']
|
259
|
-
basic_hosts[1]['roles'] = ['dashboard', 'agent']
|
260
|
-
basic_hosts[2]['roles'] = ['database', 'agent']
|
261
|
-
basic_hosts }
|
262
|
-
let( :answers ) { Beaker::Answers.create(@ver, hosts, options) }
|
263
|
-
let( :upgrade_answers ) { Beaker::Answers.create(@ver, hosts, options.merge( {:type => :upgrade}) ) }
|
264
|
-
|
265
|
-
before :each do
|
266
|
-
@ver = '3.99'
|
267
|
-
@answers = answers.answers
|
268
|
-
end
|
269
|
-
|
270
|
-
it 'should not have q_puppet_cloud_install key' do
|
271
|
-
hosts.each do |host|
|
272
|
-
expect( host[:answers] ).to_not include :q_puppet_cloud_install
|
273
|
-
end
|
274
|
-
end
|
275
|
-
|
276
|
-
it 'should add q_pe_check_for_updates to master' do
|
277
|
-
expect( @answers['vm1'][:q_pe_check_for_updates] ).to be === 'n'
|
278
|
-
end
|
279
|
-
|
280
|
-
it 'should add q_pe_check_for_updates to dashboard' do
|
281
|
-
expect( @answers['vm2'][:q_pe_check_for_updates] ).to be === 'n'
|
282
|
-
end
|
283
|
-
|
284
|
-
it 'should not add q_pe_check_for_updates to agent/database' do
|
285
|
-
expect( @answers['vm3']).to_not include :q_pe_check_for_updates
|
286
|
-
end
|
287
|
-
|
288
|
-
# re-enable these tests once these keys are eliminated
|
289
|
-
#
|
290
|
-
# it 'should not have q_puppet_enterpriseconsole_database_name key' do
|
291
|
-
# hosts.each do |host|
|
292
|
-
# expect( host[:answers] ).to_not include :q_puppet_enterpriseconsole_database_name
|
293
|
-
# end
|
294
|
-
# end
|
295
|
-
#
|
296
|
-
# it 'should not have q_puppet_enterpriseconsole_database_password key' do
|
297
|
-
# hosts.each do |host|
|
298
|
-
# expect( host[:answers] ).to_not include :q_puppet_enterpriseconsole_database_password
|
299
|
-
# end
|
300
|
-
# end
|
301
|
-
#
|
302
|
-
# it 'should not have q_puppet_enterpriseconsole_database_user key' do
|
303
|
-
# hosts.each do |host|
|
304
|
-
# expect( host[:answers] ).to_not include :q_puppet_enterpriseconsole_database_user
|
305
|
-
# end
|
306
|
-
# end
|
307
|
-
|
308
|
-
it ':q_update_server_host should default to the master' do
|
309
|
-
hosts.each do |host|
|
310
|
-
expect( host[:answers][:q_update_server_host] ).to be == hosts[0].to_s
|
311
|
-
end
|
312
|
-
end
|
313
|
-
|
314
|
-
it 'only the master should have :q_install_update_server' do
|
315
|
-
hosts.each do |host|
|
316
|
-
if host[:roles].include? 'master'
|
317
|
-
expect( host[:answers][:q_install_update_server] ).to be == 'y'
|
318
|
-
else
|
319
|
-
expect( host[:answers] ).to_not include :q_install_update_server
|
320
|
-
end
|
321
|
-
end
|
322
|
-
end
|
323
|
-
|
324
|
-
it 'should add answers to the host objects' do
|
325
|
-
hosts.each do |host|
|
326
|
-
expect( host[:answers] ).to be === @answers[host.name]
|
327
|
-
end
|
328
|
-
end
|
329
|
-
end
|
330
|
-
|
331
|
-
describe Version32 do
|
332
|
-
let( :options ) { Beaker::Options::Presets.new.presets }
|
333
|
-
let( :basic_hosts ) { make_hosts( {'pe_ver' => @ver } ) }
|
334
|
-
let( :hosts ) { basic_hosts[0]['roles'] = ['master', 'agent']
|
335
|
-
basic_hosts[1]['roles'] = ['dashboard', 'agent']
|
336
|
-
basic_hosts[2]['roles'] = ['database', 'agent']
|
337
|
-
basic_hosts }
|
338
|
-
let( :answers ) { Beaker::Answers.create(@ver, hosts, options) }
|
339
|
-
let( :upgrade_answers ) { Beaker::Answers.create(@ver, hosts, options.merge( {:type => :upgrade}) ) }
|
340
|
-
|
341
|
-
before :each do
|
342
|
-
@ver = '3.2'
|
343
|
-
@answers = answers.answers
|
344
|
-
end
|
345
|
-
|
346
|
-
it 'should add q_pe_check_for_updates to master' do
|
347
|
-
expect( @answers['vm1'][:q_pe_check_for_updates] ).to be === 'n'
|
348
|
-
end
|
349
|
-
|
350
|
-
it 'should add q_pe_check_for_updates to dashboard' do
|
351
|
-
expect( @answers['vm2'][:q_pe_check_for_updates] ).to be === 'n'
|
352
|
-
end
|
353
|
-
|
354
|
-
it 'should not add q_pe_check_for_updates to agent/database' do
|
355
|
-
expect( @answers['vm3']).to_not include :q_pe_check_for_updates
|
356
|
-
end
|
357
|
-
|
358
|
-
# The only difference between 3.2 and 3.0 is the addition of the
|
359
|
-
# master certname to the dashboard answers
|
360
|
-
it 'should add q_puppetmaster_certname to the dashboard answers' do
|
361
|
-
expect( @answers['vm2']).to include :q_puppetmaster_certname
|
362
|
-
end
|
363
|
-
|
364
|
-
it 'should add q_upgrade_with_unknown_disk_space to the dashboard on upgrade' do
|
365
|
-
@upgrade_answers = upgrade_answers.answers
|
366
|
-
expect( @upgrade_answers['vm2']).to include :q_upgrade_with_unknown_disk_space
|
367
|
-
end
|
368
|
-
|
369
|
-
it 'should add answers to the host objects' do
|
370
|
-
hosts.each do |host|
|
371
|
-
expect( host[:answers] ).to be === @answers[host.name]
|
372
|
-
end
|
373
|
-
end
|
374
|
-
end
|
375
|
-
|
376
|
-
describe Version30 do
|
377
|
-
let( :options ) { Beaker::Options::Presets.new.presets }
|
378
|
-
let( :basic_hosts ) { make_hosts( { 'pe_ver' => @ver } ) }
|
379
|
-
let( :hosts ) { basic_hosts[0]['roles'] = ['master', 'database', 'dashboard']
|
380
|
-
basic_hosts[1]['platform'] = 'windows'
|
381
|
-
basic_hosts[2][:custom_answers] = { :q_custom => 'LOOKLOOKLOOK' }
|
382
|
-
basic_hosts }
|
383
|
-
let( :answers ) { Beaker::Answers.create(@ver, hosts, options) }
|
384
|
-
let( :upgrade_answers ) { Beaker::Answers.create(@ver, hosts, options.merge( {:type => :upgrade}) ) }
|
385
|
-
|
386
|
-
before :each do
|
387
|
-
@ver = '3.0'
|
388
|
-
@answers = answers.answers
|
389
|
-
end
|
390
|
-
|
391
|
-
it 'uses simple answers for upgrade from 3.0.x to 3.0.x' do
|
392
|
-
@upgrade_answers = upgrade_answers.answers
|
393
|
-
expect( @upgrade_answers ).to be === { "vm2"=>{ :q_install=>"y", :q_install_vendor_packages=>"y" }, "vm1"=>{ :q_install=>"y", :q_install_vendor_packages=>"y" }, "vm3"=>{ :q_install=>"y", :q_install_vendor_packages=>"y", :q_custom=>"LOOKLOOKLOOK" } }
|
394
|
-
end
|
395
|
-
|
396
|
-
it 'sets correct answers for an agent' do
|
397
|
-
@ver = '3.0'
|
398
|
-
expect( @answers['vm3'] ).to be === { :q_install=>"y", :q_vendor_packages_install=>"y", :q_puppetagent_install=>"y", :q_puppet_cloud_install=>"y", :q_verify_packages=>"y", :q_puppet_symlinks_install=>"y", :q_puppetagent_certname=>hosts[2].to_s, :q_puppetagent_server=>hosts[0].to_s, :q_puppetmaster_install=>"n", :q_all_in_one_install=>"n", :q_puppet_enterpriseconsole_install=>"n", :q_puppetdb_install=>"n", :q_database_install=>"n", :q_custom=>"LOOKLOOKLOOK" }
|
399
|
-
end
|
400
|
-
|
401
|
-
it 'sets correct answers for a master' do
|
402
|
-
@ver = '3.0'
|
403
|
-
expect( @answers['vm1'] ).to be === { :q_install=>"y", :q_vendor_packages_install=>"y", :q_puppetagent_install=>"y", :q_puppet_cloud_install=>"y", :q_verify_packages=>"y", :q_puppet_symlinks_install=>"y", :q_puppetagent_certname=>hosts[0].to_s, :q_puppetagent_server=>hosts[0].to_s, :q_puppetmaster_install=>"y", :q_all_in_one_install=>"y", :q_puppet_enterpriseconsole_install=>"y", :q_puppetdb_install=>"y", :q_database_install=>"y", :q_puppetdb_hostname=>hosts[0].to_s, :q_puppetdb_port=>8081, :q_puppetmaster_dnsaltnames=>"#{hosts[0].to_s},#{hosts[0][:ip]},puppet", :q_puppetmaster_enterpriseconsole_hostname=>hosts[0].to_s, :q_puppetmaster_enterpriseconsole_port=>443, :q_puppetmaster_certname=>hosts[0].to_s, :q_puppetdb_database_name=>"pe-puppetdb", :q_puppetdb_database_user=>"mYpdBu3r", :q_puppetdb_database_password=>"'~!@\#$%^*-/ aZ'", :q_puppet_enterpriseconsole_auth_database_name=>"console_auth", :q_puppet_enterpriseconsole_auth_database_user=>"mYu7hu3r", :q_puppet_enterpriseconsole_auth_database_password=>"'~!@\#$%^*-/ aZ'", :q_puppet_enterpriseconsole_database_name=>"console", :q_puppet_enterpriseconsole_database_user=>"mYc0nS03u3r", :q_puppet_enterpriseconsole_database_password=>"'~!@\#$%^*-/ aZ'", :q_database_host=>hosts[0].to_s, :q_database_port=>5432, :q_pe_database=>"y", :q_puppet_enterpriseconsole_inventory_hostname=>hosts[0].to_s, :q_puppet_enterpriseconsole_inventory_certname=>hosts[0].to_s, :q_puppet_enterpriseconsole_inventory_dnsaltnames=>hosts[0].to_s, :q_puppet_enterpriseconsole_inventory_port=>8140, :q_puppet_enterpriseconsole_master_hostname=>hosts[0].to_s, :q_puppet_enterpriseconsole_auth_user_email=>"'admin@example.com'", :q_puppet_enterpriseconsole_auth_password=>"'~!@\#$%^*-/ aZ'", :q_puppet_enterpriseconsole_httpd_port=>443, :q_puppet_enterpriseconsole_smtp_host=>"'vm1'", :q_puppet_enterpriseconsole_smtp_use_tls=>"'n'", :q_puppet_enterpriseconsole_smtp_port=>"'25'", :q_database_root_password=>"'=ZYdjiP3jCwV5eo9s1MBd'", :q_database_root_user=>"pe-postgres" }
|
404
|
-
end
|
405
|
-
|
406
|
-
it 'generates nil answers for a windows host' do
|
407
|
-
@ver = '3.0'
|
408
|
-
expect( @answers['vm2'] ).to be === nil
|
409
|
-
end
|
410
|
-
|
411
|
-
it 'should add answers to the host objects' do
|
412
|
-
@ver = '3.0'
|
413
|
-
a = answers.answers
|
414
|
-
hosts.each do |host|
|
415
|
-
expect( host[:answers] ).to be === @answers[host.name]
|
416
|
-
end
|
417
|
-
end
|
418
|
-
|
419
|
-
it 'appends custom answers to generated answers' do
|
420
|
-
expect( hosts[2][:custom_answers] ).to be == { :q_custom => 'LOOKLOOKLOOK' }
|
421
|
-
expect( @answers['vm3'] ).to include :q_custom
|
422
|
-
expect( hosts[2][:answers] ).to include :q_custom
|
423
|
-
end
|
424
|
-
end
|
425
|
-
|
426
|
-
describe Version28 do
|
427
|
-
let( :options ) { Beaker::Options::Presets.new.presets }
|
428
|
-
let( :basic_hosts ) { make_hosts( { 'pe_ver' => @ver } ) }
|
429
|
-
let( :hosts ) { basic_hosts[0]['roles'] = ['master', 'database', 'dashboard']
|
430
|
-
basic_hosts[1]['platform'] = 'windows'
|
431
|
-
basic_hosts }
|
432
|
-
let( :answers ) { Beaker::Answers.create(@ver, hosts, options) }
|
433
|
-
|
434
|
-
before :each do
|
435
|
-
@ver = '2.8'
|
436
|
-
@answers = answers.answers
|
437
|
-
end
|
438
|
-
|
439
|
-
it 'sets correct answers for an agent' do
|
440
|
-
expect( @answers['vm3'] ).to be === { :q_install=>"y", :q_puppetagent_install=>"y", :q_puppet_cloud_install=>"y", :q_puppet_symlinks_install=>"y", :q_vendor_packages_install=>"y", :q_puppetagent_certname=>hosts[2].to_s, :q_puppetagent_server=>hosts[0].to_s, :q_puppetmaster_install=>"n", :q_puppet_enterpriseconsole_install=>"n" }
|
441
|
-
end
|
442
|
-
|
443
|
-
it 'sets correct answers for a master' do
|
444
|
-
expect( @answers['vm1'] ).to be === { :q_install=>"y", :q_puppetagent_install=>"y", :q_puppet_cloud_install=>"y", :q_puppet_symlinks_install=>"y", :q_vendor_packages_install=>"y", :q_puppetagent_certname=>hosts[0].to_s, :q_puppetagent_server=>hosts[0].to_s, :q_puppetmaster_install=>"y", :q_puppet_enterpriseconsole_install=>"y", :q_puppetmaster_certname=>hosts[0].to_s, :q_puppetmaster_dnsaltnames=>"#{hosts[0].to_s},#{hosts[0][:ip]},puppet", :q_puppetmaster_enterpriseconsole_hostname=>hosts[0].to_s, :q_puppetmaster_enterpriseconsole_port=>443, :q_puppetmaster_forward_facts=>"y", :q_puppet_enterpriseconsole_database_install=>"y", :q_puppet_enterpriseconsole_auth_database_name=>"console_auth", :q_puppet_enterpriseconsole_auth_database_user=>"mYu7hu3r", :q_puppet_enterpriseconsole_auth_database_password=>"'~!@\#$%^*-/ aZ'", :q_puppet_enterpriseconsole_database_name=>"console", :q_puppet_enterpriseconsole_database_user=>"mYc0nS03u3r", :q_puppet_enterpriseconsole_database_password=>"'~!@\#$%^*-/ aZ'", :q_puppet_enterpriseconsole_inventory_hostname=>hosts[0].to_s, :q_puppet_enterpriseconsole_inventory_certname=>hosts[0].to_s, :q_puppet_enterpriseconsole_inventory_dnsaltnames=>hosts[0].to_s, :q_puppet_enterpriseconsole_inventory_port=>8140, :q_puppet_enterpriseconsole_master_hostname=>hosts[0].to_s, :q_puppet_enterpriseconsole_auth_user_email=>"'admin@example.com'", :q_puppet_enterpriseconsole_auth_password=>"'~!@\#$%^*-/ aZ'", :q_puppet_enterpriseconsole_httpd_port=>443, :q_puppet_enterpriseconsole_smtp_host=>"'vm1'", :q_puppet_enterpriseconsole_smtp_use_tls=>"'n'", :q_puppet_enterpriseconsole_smtp_port=>"'25'", :q_puppet_enterpriseconsole_auth_user=>"'admin@example.com'" }
|
445
|
-
end
|
446
|
-
|
447
|
-
it 'generates nil answers for a windows host' do
|
448
|
-
expect( @answers['vm2'] ).to be === nil
|
449
|
-
end
|
450
|
-
|
451
|
-
it 'should add answers to the host objects' do
|
452
|
-
hosts.each do |host|
|
453
|
-
expect( host[:answers] ).to be === @answers[host.name]
|
454
|
-
end
|
455
|
-
end
|
456
|
-
|
457
|
-
end
|
458
|
-
describe Version20 do
|
459
|
-
let( :options ) { Beaker::Options::Presets.new.presets }
|
460
|
-
let( :basic_hosts ) { make_hosts( { 'pe_ver' => @ver } ) }
|
461
|
-
let( :hosts ) { basic_hosts[0]['roles'] = ['master', 'database', 'dashboard']
|
462
|
-
basic_hosts[1]['platform'] = 'windows'
|
463
|
-
basic_hosts }
|
464
|
-
|
465
|
-
let( :answers ) { Beaker::Answers.create(@ver, hosts, options) }
|
466
|
-
|
467
|
-
before :each do
|
468
|
-
@ver = '2.0'
|
469
|
-
@answers = answers.answers
|
470
|
-
end
|
471
|
-
|
472
|
-
it 'sets correct answers for an agent' do
|
473
|
-
expect( @answers['vm3'] ).to be === { :q_install=>"y", :q_puppetagent_install=>"y", :q_puppet_cloud_install=>"y", :q_puppet_symlinks_install=>"y", :q_vendor_packages_install=>"y", :q_puppetagent_certname=>hosts[2].to_s, :q_puppetagent_server=>hosts[0].to_s, :q_puppetmaster_install=>"n", :q_puppet_enterpriseconsole_install=>"n" }
|
474
|
-
end
|
475
|
-
|
476
|
-
it 'sets correct answers for a master' do
|
477
|
-
expect( @answers['vm1'] ).to be === { :q_install=>"y", :q_puppetagent_install=>"y", :q_puppet_cloud_install=>"y", :q_puppet_symlinks_install=>"y", :q_vendor_packages_install=>"y", :q_puppetagent_certname=>hosts[0].to_s, :q_puppetagent_server=>hosts[0].to_s, :q_puppetmaster_install=>"y", :q_puppet_enterpriseconsole_install=>"y", :q_puppetmaster_certname=>hosts[0].to_s, :q_puppetmaster_dnsaltnames=>"#{hosts[0].to_s},#{hosts[0][:ip]},puppet", :q_puppetmaster_enterpriseconsole_hostname=>hosts[0].to_s, :q_puppetmaster_enterpriseconsole_port=>443, :q_puppetmaster_forward_facts=>"y", :q_puppet_enterpriseconsole_database_install=>"y", :q_puppet_enterpriseconsole_auth_database_name=>"console_auth", :q_puppet_enterpriseconsole_auth_database_user=>"mYu7hu3r", :q_puppet_enterpriseconsole_auth_database_password=>"'~!@\#$%^*-/ aZ'", :q_puppet_enterpriseconsole_database_name=>"console", :q_puppet_enterpriseconsole_database_user=>"mYc0nS03u3r", :q_puppet_enterpriseconsole_database_root_password=>"'~!@\#$%^*-/ aZ'", :q_puppet_enterpriseconsole_database_password=>"'~!@\#$%^*-/ aZ'", :q_puppet_enterpriseconsole_inventory_hostname=>hosts[0].to_s, :q_puppet_enterpriseconsole_inventory_certname=>hosts[0].to_s, :q_puppet_enterpriseconsole_inventory_dnsaltnames=>hosts[0].to_s, :q_puppet_enterpriseconsole_inventory_port=>8140, :q_puppet_enterpriseconsole_master_hostname=>hosts[0].to_s, :q_puppet_enterpriseconsole_auth_user_email=>"'admin@example.com'", :q_puppet_enterpriseconsole_auth_password=>"'~!@\#$%^*-/ aZ'", :q_puppet_enterpriseconsole_httpd_port=>443, :q_puppet_enterpriseconsole_smtp_host=>"'vm1'", :q_puppet_enterpriseconsole_smtp_use_tls=>"'n'", :q_puppet_enterpriseconsole_smtp_port=>"'25'", :q_puppet_enterpriseconsole_auth_user=>"'admin@example.com'" }
|
478
|
-
end
|
479
|
-
|
480
|
-
it 'generates nil answers for a windows host' do
|
481
|
-
expect( @answers['vm2'] ).to be === nil
|
482
|
-
end
|
483
|
-
|
484
|
-
it 'should add answers to the host objects' do
|
485
|
-
hosts.each do |host|
|
486
|
-
expect( host[:answers] ).to be === @answers[host.name]
|
487
|
-
end
|
488
|
-
end
|
489
|
-
end
|
490
|
-
|
491
|
-
describe 'Customization' do
|
492
|
-
let( :basic_hosts ) { make_hosts( { 'pe_ver' => @ver } ) }
|
493
|
-
let( :options ) { Beaker::Options::Presets.new.presets }
|
494
|
-
let( :hosts ) { basic_hosts[0]['roles'] = ['master', 'database', 'dashboard']
|
495
|
-
basic_hosts[1]['platform'] = 'windows'
|
496
|
-
basic_hosts }
|
497
|
-
let( :answers ) { Beaker::Answers.create(@ver, hosts, options) }
|
498
|
-
|
499
|
-
def test_answer_customization(answer_key, value_to_set)
|
500
|
-
@ver = '3.0'
|
501
|
-
options[:answers] ||= Beaker::Options::OptionsHash.new
|
502
|
-
options[:answers][answer_key] = value_to_set
|
503
|
-
host_answers = answers.answers['vm1']
|
504
|
-
expect( host_answers[answer_key] ).to be === value_to_set
|
505
|
-
end
|
506
|
-
|
507
|
-
it 'sets :q_puppetdb_hostname' do
|
508
|
-
test_answer_customization(:q_puppetdb_hostname, 'q_puppetdb_hostname_custom01')
|
509
|
-
end
|
510
|
-
|
511
|
-
it 'sets :q_puppetdb_database_user' do
|
512
|
-
test_answer_customization(:q_puppetdb_database_user, 'q_puppetdb_database_user_custom02')
|
513
|
-
end
|
514
|
-
|
515
|
-
it 'sets :q_puppetdb_database_password' do
|
516
|
-
test_answer_customization(:q_puppetdb_database_password, 'q_puppetdb_database_password_custom03')
|
517
|
-
end
|
518
|
-
|
519
|
-
it 'sets :q_puppet_enterpriseconsole_auth_database_password' do
|
520
|
-
answer = 'q_puppet_enterpriseconsole_auth_database_password_custom04'
|
521
|
-
test_answer_customization(:q_puppet_enterpriseconsole_auth_database_password, answer)
|
522
|
-
end
|
523
|
-
|
524
|
-
it 'sets :q_puppet_enterpriseconsole_database_user' do
|
525
|
-
answer = 'q_puppet_enterpriseconsole_database_user_custom05'
|
526
|
-
test_answer_customization(:q_puppet_enterpriseconsole_database_user, answer)
|
527
|
-
end
|
528
|
-
|
529
|
-
it 'sets :q_puppet_enterpriseconsole_database_password' do
|
530
|
-
answer = 'q_puppet_enterpriseconsole_database_password_custom06'
|
531
|
-
test_answer_customization(:q_puppet_enterpriseconsole_database_password, answer)
|
532
|
-
end
|
533
|
-
|
534
|
-
it 'sets :q_database_host' do
|
535
|
-
test_answer_customization(:q_database_host, 'q_database_host_custom07')
|
536
|
-
end
|
537
|
-
|
538
|
-
it 'sets :q_database_install' do
|
539
|
-
test_answer_customization(:q_database_install, 'q_database_install_custom08')
|
540
|
-
end
|
541
|
-
|
542
|
-
it 'sets :q_pe_database' do
|
543
|
-
test_answer_customization(:q_pe_database, 'q_pe_database_custom08')
|
544
|
-
end
|
545
|
-
|
546
|
-
end
|
547
|
-
end
|