beaker 2.9.0 → 2.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTRiYTFlN2E4ZTQyNWUxMWJlZGRmNzNmNTNmN2NhYzk3OTFjODYzYg==
4
+ YmY2Mjc5OTAyMTE2ODI4ZWNkMGYwMTkyMjE2NDVjNTRmM2FiYzA5Nw==
5
5
  data.tar.gz: !binary |-
6
- YjNkMGZkODlhYmM3Y2Q2ZDA5OGE1OTM2ODQ2MWIxNzkxYmViMDY3ZQ==
6
+ MzMyODZhZDIwMzJkNzYwZjdlYmVjNTNlODdjODg5NmJjNjdkNGJiNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZDkyODM0NzY1ZGY0MzdiNzViMzEyZTZhMmRiNTAyNTAzMDQzMmU3Y2IwNTM3
10
- YmQ5OWViYzYzNDUzYWE5OTlmNGNkZjljNzgwMmE4MmQwODZhNTE3ZTQ4MjZl
11
- ODE3Mzg1MmMxOTFjMmRhMWM5ZmFmNGRjOWExNWU1MGFhYjQ5MjM=
9
+ ZjRmYmIzOGJmMzE2YWNiYjVmMWUzMGQyYjgwNTg3NzU0NDdmNGQ4ZDhiNThl
10
+ MmE2NmU3MWU3OWRhMGYwZjQ0ZDQ2ZTc2M2U1NGVjNDJhNDZhYTI4MzkzOWEz
11
+ N2JiNmVhNjRiYmJmM2U2NzM1Mjg0NDA5ZTg2MGFjYTA4NGM5ZmI=
12
12
  data.tar.gz: !binary |-
13
- MDEzZjUxNmZmMmI1MjdiZjcwZjFjNDY3ODA2MDdlYmY3MTQwNGMxZWNjNjcy
14
- MmM4NzZhMjcxMDljNWE4NDU4MGE3MmQ2MGQxYWFhOWNjMzYzZTk2M2Y2MmU5
15
- MThkNWE5MTQzYjRmNDg3MWU3MzQyZjA4MjVlYzZhZDZhZDFkZWE=
13
+ YTk0ZThhMGRkYzEwMWRjNjdkNTBkZmE3NzI0Y2E3YjcyOWI5NmYwOTExYjg4
14
+ MDA1MzY5YzE4NDVjMWE5N2MzYTczZjdhMjRlOWQwZGUzMGUxZmJhNWM4N2E2
15
+ YTU2YjFmN2JiNmZlMjgyNmRiYzMyYWE3ZDZiNzJlMjY0MTQ1NDg=
data/HISTORY.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # default - History
2
2
  ## Tags
3
- * [LATEST - 9 Apr, 2015 (901c4a94)](#LATEST)
3
+ * [LATEST - 22 Apr, 2015 (2f834676)](#LATEST)
4
+ * [2.9.0 - 9 Apr, 2015 (b161d325)](#2.9.0)
4
5
  * [beaker2.8.0 - 26 Mar, 2015 (2d25d06d)](#beaker2.8.0)
5
6
  * [beaker2.7.1 - 19 Mar, 2015 (45b2bf10)](#beaker2.7.1)
6
7
  * [beaker2.7.0 - 19 Mar, 2015 (38b14ef8)](#beaker2.7.0)
@@ -77,7 +78,195 @@
77
78
  * [pe1.2 - 6 Sep, 2011 (ba3dadd2)](#pe1.2)
78
79
 
79
80
  ## Details
80
- ### <a name = "LATEST">LATEST - 9 Apr, 2015 (901c4a94)
81
+ ### <a name = "LATEST">LATEST - 22 Apr, 2015 (2f834676)
82
+
83
+ * (GEM) update beaker version to 2.10.0 (2f834676)
84
+
85
+ * Merge pull request #777 from kevpl/bkr184_repos_addoption (c68967e3)
86
+
87
+
88
+ ```
89
+ Merge pull request #777 from kevpl/bkr184_repos_addoption
90
+
91
+ (BKR-184) generalized repo selection code for install_puppetlabs_dev_repo
92
+ ```
93
+ * Merge pull request #775 from kevpl/bkr4_hostsfile_reuse (433d7ccd)
94
+
95
+
96
+ ```
97
+ Merge pull request #775 from kevpl/bkr4_hostsfile_reuse
98
+
99
+ (BKR-4) Beaker now dumps re-usable hosts file when SUTs are preserved
100
+ ```
101
+ * Merge pull request #787 from er0ck/fix/master/BKR-209-check_for_package_and_host_prebuild_sles10 (c256ebd7)
102
+
103
+
104
+ ```
105
+ Merge pull request #787 from er0ck/fix/master/BKR-209-check_for_package_and_host_prebuild_sles10
106
+
107
+ (BKR-209) check for package and host prebuild sles10
108
+ ```
109
+ * (BKR-209) check for package and host prebuild sles10 (f21ad513)
110
+
111
+
112
+ ```
113
+ (BKR-209) check for package and host prebuild sles10
114
+
115
+ this change fixes check_for_package on sles10 in which zypper always
116
+ returns 0, even if a package is not found.
117
+ This change also removes ntp package from the host pre-build steps.
118
+ sles10 comes with ntp_command installed.
119
+ ```
120
+ * Merge pull request #785 from anodelman/cherry (8eb9a543)
121
+
122
+
123
+ ```
124
+ Merge pull request #785 from anodelman/cherry
125
+
126
+ (BKR-196) add 'reboot' host method
127
+ ```
128
+ * (BKR-196) add 'reboot' host method (53cd051b)
129
+
130
+
131
+ ```
132
+ (BKR-196) add 'reboot' host method
133
+
134
+ - added host.reboot method
135
+ - added acceptance test to ensure functionality
136
+ ```
137
+ * Merge pull request #733 from fiddyspence/feature/better_openstack_ip_assignment_handling (d854fcae)
138
+
139
+
140
+ ```
141
+ Merge pull request #733 from fiddyspence/feature/better_openstack_ip_assignment_handling
142
+
143
+ (gh-732) Better Openstack IP address assignment
144
+ ```
145
+ * Merge pull request #752 from petems/MAINT-fix_install_puppet_from_msi_on_cygwin (1333f9bd)
146
+
147
+
148
+ ```
149
+ Merge pull request #752 from petems/MAINT-fix_install_puppet_from_msi_on_cygwin
150
+
151
+ (MAINT) Fix install_puppet_from msi_on non-cygwin
152
+ ```
153
+ * Merge pull request #765 from petems/BKR-113-add_freesbd_vagrant_options (6bec19f7)
154
+
155
+
156
+ ```
157
+ Merge pull request #765 from petems/BKR-113-add_freesbd_vagrant_options
158
+
159
+ (BKR-113) Adds FreeBSD Vagrantfile logic
160
+ ```
161
+ * Merge pull request #766 from petems/BKR-113-host_prebuild_steps_for_freebsd (59873206)
162
+
163
+
164
+ ```
165
+ Merge pull request #766 from petems/BKR-113-host_prebuild_steps_for_freebsd
166
+
167
+ (BKR-113) Host Prebuilt commands for FreeBSD
168
+ ```
169
+ * Merge pull request #774 from electrical/centos7 (00434a4f)
170
+
171
+
172
+ ```
173
+ Merge pull request #774 from electrical/centos7
174
+
175
+ modifications for CentOS-7
176
+ ```
177
+ * Merge pull request #779 from kevpl/bkr150_sut_changename (85e45d64)
178
+
179
+
180
+ ```
181
+ Merge pull request #779 from kevpl/bkr150_sut_changename
182
+
183
+ (BKR-150) changed host name to host.log_prefix for extra context in sut.log
184
+ ```
185
+ * Merge pull request #683 from fiddyspence/bug/openstack_multi_host_blurn (57e398a5)
186
+
187
+
188
+ ```
189
+ Merge pull request #683 from fiddyspence/bug/openstack_multi_host_blurn
190
+
191
+ (gh-687) [openstack] multi node root user enable
192
+ ```
193
+ * Merge pull request #784 from anodelman/answers (35632798)
194
+
195
+
196
+ ```
197
+ Merge pull request #784 from anodelman/answers
198
+
199
+ (BKR-182) Disable check_for_updates by default with beaker
200
+ ```
201
+ * (BKR-182) Disable check_for_updates by default with beaker (75384994)
202
+
203
+
204
+ ```
205
+ (BKR-182) Disable check_for_updates by default with beaker
206
+
207
+ - added to version 3.2+
208
+ ```
209
+ * (BKR-150) changed host name to host.log_prefix for extra context in sut.log (7ec8d8e8)
210
+
211
+ * (BKR-184) generalized repo selection code for install_puppetlabs_dev_repo (b3b519ea)
212
+
213
+ * (BKR-4) Beaker now dumps re-usable hosts file when SUTs are preserved (03f7262f)
214
+
215
+ * (BKR-116) modifications for CentOS-7 (1d961ccc)
216
+
217
+ * (BKR-113) Host Prebuilt commands for FreeBSD (39038ad3)
218
+
219
+
220
+ ```
221
+ (BKR-113) Host Prebuilt commands for FreeBSD
222
+
223
+ Since FreeBSD echo is different from Linux-y echo, it's much easier to just use printf and escape the strings using gsub.
224
+ ```
225
+ * (BKR-113) Adds FreeBSD Vagrantfile logic (95429ad7)
226
+
227
+
228
+ ```
229
+ (BKR-113) Adds FreeBSD Vagrantfile logic
230
+
231
+ With Vagrant we use rsync for folder sync, as nfs has a character restriction of 88 characters. So depending on the module name and where it's being stored, it can error out:
232
+
233
+
234
+
235
+ ==> default: Mounting NFS shared folders...
236
+ The following SSH command responded with a non-zero exit status.
237
+ Vagrant assumes that this means the command failed!
238
+
239
+ mount -t nfs '10.0.1.1:/Users/petersouter/projects/reallylongpathnameover88characterssothatmountfswillfail12345678910111213141516' '/vagrant'
240
+
241
+ Stdout from the command:
242
+
243
+ Stderr from the command:
244
+
245
+ mount_nfs: 10.0.1.1:/Users/petersouter/projects/reallylongpathnameover88characterssothatmountfswillfail12345678910111213141516: File name too long
246
+
247
+
248
+
249
+ Further reading if interested:
250
+ http://www.secnetix.de/olli/FreeBSD/mnamelen.hawk
251
+ https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=167105
252
+ ```
253
+ * (MAINT) Changes msi install commands run when on non-cygwin (89dabc69)
254
+
255
+ * (MAINT) Changes msi install commands ran... (effcde41)
256
+
257
+
258
+ ```
259
+ (MAINT) Changes msi install commands ran...
260
+
261
+ When on non-cygwin Windows, use `start` not cmd
262
+ ```
263
+ * (gh-732) Better Openstack IP address assignment (e1fcd580)
264
+
265
+ * (gh-687) [openstack] Previously, the method attemped to set root on all nodes, even if the node was not up yet (802db0e9)
266
+
267
+ ### <a name = "2.9.0">2.9.0 - 9 Apr, 2015 (b161d325)
268
+
269
+ * (HISTORY) update beaker history for gem release 2.9.0 (b161d325)
81
270
 
82
271
  * (GEM) update beaker version to 2.9.0 (901c4a94)
83
272
 
@@ -152,3 +152,9 @@ hosts.each do |host|
152
152
  assert_equal(0, host_paths.length, "there are extra paths on #{host} (#{host_paths})")
153
153
  end
154
154
  end
155
+
156
+ step "#reboot: can reboot the host"
157
+ hosts.each do |host|
158
+ host.reboot
159
+ on host, "echo #{host} rebooted!"
160
+ end
@@ -23,6 +23,11 @@ module Beaker
23
23
  the_answers[dashboard.name][:q_puppetmaster_certname] = master
24
24
  end
25
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
+
26
31
  if @options[:type] == :upgrade && dashboard != database
27
32
  # In a split configuration, there is no way for the upgrader
28
33
  # to know how much disk space is available for the database
@@ -126,6 +126,8 @@ module Beaker
126
126
  if @network_manager
127
127
  @network_manager.cleanup
128
128
  end
129
+ else
130
+ preserve_hosts_file if @options[:provision]
129
131
  end
130
132
 
131
133
  if @logger.is_debug?
@@ -149,7 +151,38 @@ module Beaker
149
151
  ).run_and_raise_on_failure
150
152
  end
151
153
 
152
- # @see print_env_vars_affecting_beaker & print_command_line
154
+ # Sets aside the current hosts file for re-use with the --no-provision flag.
155
+ # This is originally intended for use on a successful tests where the hosts
156
+ # are preserved (the --preserve-hosts option is set accordingly).
157
+ # It copies the current hosts file to the log directory, and rewrites the SUT
158
+ # names to match their names during the finishing run.
159
+ #
160
+ # @return nil
161
+ def preserve_hosts_file
162
+ preserved_hosts_filename = File.join(@options[:log_dated_dir], File.basename(@options[:hosts_file]))
163
+ FileUtils.cp(@options[:hosts_file], preserved_hosts_filename)
164
+ hosts_yaml = YAML.load_file(preserved_hosts_filename)
165
+ newly_keyed_hosts_entries = {}
166
+ hosts_yaml['HOSTS'].each do |host_name, host_hash|
167
+ @hosts.each do |host|
168
+ if host_name == host.instance_variable_get(:@name)
169
+ newly_keyed_hosts_entries[host.to_s] = host_hash
170
+ break
171
+ end
172
+ end
173
+ end
174
+ hosts_yaml['HOSTS'] = newly_keyed_hosts_entries
175
+ File.open(preserved_hosts_filename, 'w') do |file|
176
+ YAML.dump(hosts_yaml, file)
177
+ end
178
+ @options[:hosts_preserved_yaml_file] = preserved_hosts_filename
179
+ end
180
+
181
+ # Prints all information required to reproduce the current run & results to the log
182
+ # @see #print_env_vars_affecting_beaker
183
+ # @see #print_command_line
184
+ #
185
+ # @return nil
153
186
  def print_reproduction_info( log_level = :debug )
154
187
  print_command_line( log_level )
155
188
  print_env_vars_affecting_beaker( log_level )
@@ -187,13 +220,66 @@ module Beaker
187
220
  # Prints the command line that can be called to reproduce this run
188
221
  # (assuming the environment is the same)
189
222
  # @param [Symbol] log_level The log level (coloring) to print the message at
190
- # @example Print pertinent env vars using error leve reporting (red)
223
+ # @example Print pertinent env vars using error level reporting (red)
191
224
  # print_command_line :error
192
225
  #
226
+ # @note Re-use of already provisioned SUTs has been tested against the vmpooler & vagrant boxes.
227
+ # Fusion doesn't need this, as it has no cleanup steps. Docker is untested at this time.
228
+ # Please contact @electrical or the Puppet QE Team for more info, or for requests to support this.
229
+ #
193
230
  # @return nil
194
231
  def print_command_line( log_level = :debug )
195
232
  @logger.send(log_level, "\nYou can reproduce this run with:\n")
196
233
  @logger.send(log_level, @options[:command_line])
234
+ if @options[:hosts_preserved_yaml_file]
235
+ set_docker_warning = false
236
+ has_supported_hypervisor = false
237
+ @hosts.each do |host|
238
+ case host[:hypervisor]
239
+ when /vagrant|fusion|vmpooler|vcloud/
240
+ has_supported_hypervisor = true
241
+ when /docker/
242
+ set_docker_warning = true
243
+ end
244
+ end
245
+ if has_supported_hypervisor
246
+ reproducing_command = build_hosts_preserved_reproducing_command(@options[:command_line], @options[:hosts_preserved_yaml_file])
247
+ @logger.send(log_level, "\nYou can re-run commands against the already provisioned SUT(s) with:\n")
248
+ @logger.send(log_level, '(docker support is untested for this feature. please reference the docs for more info)') if set_docker_warning
249
+ @logger.send(log_level, reproducing_command)
250
+ end
251
+ end
252
+ end
253
+
254
+ # provides a new version of the command given, edited for re-use with a
255
+ # preserved host. It does this by swapping the hosts file out for the
256
+ # new_hostsfile argument and setting the --no-provision flag, removing
257
+ # any previously set provisioning flags that it finds.
258
+ #
259
+ # @param [String] command Command line parameters to edit.
260
+ # @param [String] new_hostsfile Path to the new hosts file to use.
261
+ #
262
+ # @return [String] The command line parameters edited for re-use
263
+ def build_hosts_preserved_reproducing_command(command, new_hostsfile)
264
+ command_parts = command.split(' ')
265
+ has_no_provision_flag = false
266
+ replace_hosts_file_next = false
267
+ reproducing_command = []
268
+ command_parts.each do |part|
269
+ if replace_hosts_file_next
270
+ reproducing_command << new_hostsfile
271
+ replace_hosts_file_next = false
272
+ next
273
+ elsif part == '--provision' || part == '--no-provision'
274
+ has_no_provision_flag = true
275
+ next
276
+ elsif part == '--hosts'
277
+ replace_hosts_file_next = true
278
+ end
279
+ reproducing_command << part
280
+ end
281
+ reproducing_command << '--no-provision' unless has_no_provision_flag
282
+ reproducing_command.join(' ')
197
283
  end
198
284
  end
199
285
  end
@@ -369,15 +369,16 @@ module Beaker
369
369
  else
370
370
  dest = "C:\\Windows\\Temp\\#{host['dist']}.msi"
371
371
 
372
- on host, "set PATH=\"%PATH%;#{host['puppetbindir']}\""
373
- on host, "setx PATH \"%PATH%;#{host['puppetbindir']}\""
374
-
375
372
  on host, powershell("$webclient = New-Object System.Net.WebClient; $webclient.DownloadFile('#{link}','#{dest}')")
376
373
 
377
- on host, "if not exist #{host['distmoduledir']} (md #{host['distmoduledir']})"
374
+ host.mkdir_p host['distmoduledir']
378
375
  end
379
376
 
380
- on host, "cmd /C 'start /w msiexec.exe /qn /i #{dest}'"
377
+ if host.is_cygwin?
378
+ on host, "cmd /C 'start /w msiexec.exe /qn /i #{dest}'"
379
+ else
380
+ on host, "start /w msiexec.exe /qn /i #{dest}"
381
+ end
381
382
  end
382
383
 
383
384
  # Installs Puppet and dependencies from dmg
@@ -542,18 +543,23 @@ module Beaker
542
543
  # @param [String] repo_configs_dir A local directory where repository files will be
543
544
  # stored as an intermediate step before
544
545
  # pushing them to the given host.
546
+ # @param [Hash{Symbol=>String}] opts Options to alter execution.
547
+ # @option opts [String] :dev_builds_url The URL to look for dev builds.
548
+ # @option opts [String, Array<String>] :dev_builds_repos The repo(s)
549
+ # to check for dev builds in.
545
550
  #
546
551
  # @note This method only works on redhat-like and debian-like hosts.
547
552
  #
548
553
  def install_puppetlabs_dev_repo ( host, package_name, build_version,
549
- repo_configs_dir = 'tmp/repo_configs' )
554
+ repo_configs_dir = 'tmp/repo_configs',
555
+ opts = options )
550
556
  variant, version, arch, codename = host['platform'].to_array
551
557
  platform_configs_dir = File.join(repo_configs_dir, variant)
552
558
 
553
559
  # some of the uses of dev_builds_url below can't include protocol info,
554
560
  # plus this opens up possibility of switching the behavior on provided
555
561
  # url type
556
- _, protocol, hostname = options[:dev_builds_url].partition /.*:\/\//
562
+ _, protocol, hostname = opts[:dev_builds_url].partition /.*:\/\//
557
563
  dev_builds_url = protocol + hostname
558
564
 
559
565
  on host, "mkdir -p /root/#{package_name}"
@@ -583,25 +589,22 @@ module Beaker
583
589
  repo_filename,
584
590
  platform_configs_dir)
585
591
 
586
- link = "%s/%s/%s/repos/%s/%s%s/PC1/%s/" %
587
- [ dev_builds_url, package_name, build_version, variant,
588
- fedora_prefix, version, arch ]
589
-
590
- if not link_exists?( link )
591
- link = "%s/%s/%s/repos/%s/%s%s/products/%s/" %
592
+ link = nil
593
+ package_repos = opts[:dev_builds_repos].nil? ? [] : [opts[:dev_builds_repos]]
594
+ package_repos.push(['products', 'devel']).flatten!
595
+ package_repos.each do |repo|
596
+ link = "%s/%s/%s/repos/%s/%s%s/%s/%s/" %
592
597
  [ dev_builds_url, package_name, build_version, variant,
593
- fedora_prefix, version, arch ]
594
- end
595
-
596
- if not link_exists?( link )
597
- link = "%s/%s/%s/repos/%s/%s%s/devel/%s/" %
598
- [ dev_builds_url, package_name, build_version, variant,
599
- fedora_prefix, version, arch ]
600
- end
598
+ fedora_prefix, version, repo, arch ]
601
599
 
602
- if not link_exists?( link )
603
- raise "Unable to reach a repo directory at #{link}"
600
+ unless link_exists?( link )
601
+ @logger.debug("couldn't find link at '#{repo}', falling back to next option...")
602
+ else
603
+ @logger.debug("found link at '#{repo}'")
604
+ break
605
+ end
604
606
  end
607
+ raise "Unable to reach a repo directory at #{link}" unless link_exists?( link )
605
608
 
606
609
  repo_dir = fetch_http_dir( link, platform_configs_dir )
607
610
 
@@ -632,11 +635,25 @@ module Beaker
632
635
  scp_to host, list, config_dir
633
636
  scp_to host, repo_dir, "/root/#{package_name}"
634
637
 
635
- pc1_check = on( host,
636
- "[[ -d /root/#{package_name}/#{codename}/PC1 ]]",
637
- :acceptable_exit_codes => [0,1] )
638
+ repo_name = nil
639
+ package_repos = opts[:dev_builds_repos].nil? ? [] : [opts[:dev_builds_repos]]
640
+ package_repos.flatten!
641
+ package_repos.each do |repo|
642
+ repo_path = "/root/#{package_name}/#{codename}/#{repo}"
643
+ repo_check = on(host, "[[ -d #{repo_path} ]]", :acceptable_exit_codes => [0,1])
644
+ if repo_check.exit_code == 0
645
+ @logger.debug("found repo at '#{repo_path}'")
646
+ repo_name = repo
647
+ break
648
+ else
649
+ @logger.debug("couldn't find repo at '#{repo_path}', falling back to next option...")
650
+ end
651
+ end
652
+ if repo_name.nil?
653
+ repo_name = 'main'
654
+ @logger.debug("using default repo '#{repo_name}'")
655
+ end
638
656
 
639
- repo_name = pc1_check.exit_code == 0 ? 'PC1' : 'main'
640
657
  search = "deb\\s\\+http:\\/\\/#{hostname}.*$"
641
658
  replace = "deb file:\\/\\/\\/root\\/#{package_name}\\/#{codename} #{codename} #{repo_name}"
642
659
  sed_command = "sed -i 's/#{search}/#{replace}/'"
@@ -728,11 +745,11 @@ module Beaker
728
745
  end
729
746
 
730
747
  # This method will install a pem file certifcate on a windows host
731
- #
748
+ #
732
749
  # @param [Host] host A host object
733
750
  # @param [String] cert_name The name of the pem file
734
751
  # @param [String] cert The contents of the certificate
735
- #
752
+ #
736
753
  def install_cert_on_windows(host, cert_name, cert)
737
754
  create_remote_file(host, "C:\\Windows\\Temp\\#{cert_name}.pem", cert)
738
755
  on host, "certutil -v -addstore Root C:\\Windows\\Temp\\#{cert_name}.pem"