beaker 2.18.1 → 2.18.2

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
- MDk4YmZiMzQwNWUxOTczZGZjMmYwYTBhNzQ1NWQyODc3NDlhZGYzMg==
4
+ ZjJkOGY3MjE3NTZiNGQyN2UzNWY3ODU0NGJjMmU0NGZiN2U2OTRmMQ==
5
5
  data.tar.gz: !binary |-
6
- ZmU3YjQ2ZjhmNjM3ODBjZjIwYTI3YTQ2ODRjY2U1ZTgyNjlmNTY3ZA==
6
+ NTZkMTMzZWZiZTFlYjI4Y2RkYWRlMWIwNGI1NDRmNGNlZGNlYTdiNg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MzYzNzNjNTIxMTkzNTI3ZGQxZDQ3ODBjZjc4ZmQwNGNiOTdhYjE0NzlkYjk1
10
- YTdjZjk3NDRiMGU3MWQzZGIxMjg2MmFhNjcwZDQ0ZjBlYWZhOTk5OTJkN2Vk
11
- ODEzNmUxZTZlYjNmNTI2MzZmYzY0ZDNjZGQ1ZjBjMWE1NjJmMzY=
9
+ MGQzZDcxNmVmODU0YTY0MjBmMjViYjNkM2I5NmY1YjQ5M2YyZmE3OGUwNjEx
10
+ OGFhNjcwNDdlYzY2YjRlNWJkNjZjNGUyYTRmMGQwZmM4ODU3Y2MxMDg5NmMz
11
+ MGMzZGMzY2ZlYzQyZmYzYzI4MTEwZWYxMWU1NmZiYjAxNWMyOTg=
12
12
  data.tar.gz: !binary |-
13
- OGEwNDc5MjlhMDIzMGJhMThjZDk4ZTI4NmI3MTE5NDk5ZjU0ODE2ODg1OTFk
14
- YTE1ODVkNTkzMWQ2OGU5OWI4M2E4MDhlNzA2ZDc2Mzc1MGI3YTc2MGNkMmU1
15
- YWEyNjBiZDA3ZmY0OTI3MzAyOWFkN2IyOTNhMDk4ZGI3ZDVjN2U=
13
+ NDg1MjMyNjljZGYxNDFkMDI5YWI0NzUzODI0ZDg3ZGM2Y2M2MjE4YWJjNzFh
14
+ ZjI3ZTI3ZTg1YTIzZDAzY2ZkYzQxMGM1OWZmMWUyNDMwYjRhODZmMjkzM2Vk
15
+ NjIwNDY3MDExOTUxMTE1MDRiMjVkMDk3YzY1Y2RhZjQwYzhjOTc=
data/HISTORY.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # default - History
2
2
  ## Tags
3
- * [LATEST - 14 Jul, 2015 (f9939536)](#LATEST)
3
+ * [LATEST - 27 Jul, 2015 (15c0496b)](#LATEST)
4
+ * [2.18.1 - 14 Jul, 2015 (6a82f99f)](#2.18.1)
4
5
  * [2.18.0 - 13 Jul, 2015 (e018f2fc)](#2.18.0)
5
6
  * [2.17.0 - 10 Jul, 2015 (aaac4771)](#2.17.0)
6
7
  * [2.16.0 - 6 Jul, 2015 (b3e76227)](#2.16.0)
@@ -88,7 +89,202 @@
88
89
  * [pe1.2 - 6 Sep, 2011 (ba3dadd2)](#pe1.2)
89
90
 
90
91
  ## Details
91
- ### <a name = "LATEST">LATEST - 14 Jul, 2015 (f9939536)
92
+ ### <a name = "LATEST">LATEST - 27 Jul, 2015 (15c0496b)
93
+
94
+ * (GEM) update beaker version to 2.18.2 (15c0496b)
95
+
96
+ * Merge pull request #894 from anodelman/shallow (d2860c7a)
97
+
98
+
99
+ ```
100
+ Merge pull request #894 from anodelman/shallow
101
+
102
+ (BKR-405) The "install_pe" DSL Method Fails to Install SG...
103
+ ```
104
+ * Merge pull request #880 from petems/BKR-326-fix_freebsd_install (6383f3d6)
105
+
106
+
107
+ ```
108
+ Merge pull request #880 from petems/BKR-326-fix_freebsd_install
109
+
110
+ (BKR-326) Fixes FreeBSD install to use ports
111
+ ```
112
+ * Merge pull request #896 from bstopp/master (35f8e63e)
113
+
114
+
115
+ ```
116
+ Merge pull request #896 from bstopp/master
117
+
118
+ (BKR-417) Add support for specifying # of CPUs in VirtualBox
119
+ ```
120
+ * Merge pull request #900 from ferventcoder/maint/issue/start-wait-winrm (f8f01651)
121
+
122
+
123
+ ```
124
+ Merge pull request #900 from ferventcoder/maint/issue/start-wait-winrm
125
+
126
+ (maint) Always wait for Windows agent installs
127
+ ```
128
+ * Merge pull request #901 from justinstoller/bug/master/bkr-420_no-more-latest (282371b4)
129
+
130
+
131
+ ```
132
+ Merge pull request #901 from justinstoller/bug/master/bkr-420_no-more-latest
133
+
134
+ (BKR-420) Allow easily installing latest puppet-agent
135
+ ```
136
+ * (BKR-420) Allow easily installing latest puppet-agent (460a6247)
137
+
138
+
139
+ ```
140
+ (BKR-420) Allow easily installing latest puppet-agent
141
+
142
+ Prior to this we were over eagerly failing if there was no puppet-agent
143
+ version explicitly set. Having install_puppet_agent install the latest
144
+ released version of puppet-agent is a desired and common workflow.
145
+
146
+ This patch removes the aggressive failing on non-specified puppet-agent
147
+ versions in `install_puppet_agent_on`
148
+ ```
149
+ * (maint) use type over cat in pure Windows (f53a9f6d)
150
+
151
+
152
+ ```
153
+ (maint) use type over cat in pure Windows
154
+
155
+ If the host is not a cygwin environment, prefer `type` to produce the
156
+ contents of the log file over `cat`. `type` is built-in, where `cat` is
157
+ only available if someone has put *nix tools on the path, whether
158
+ through a git install (MinGW tools), installing GnuWin utils or some
159
+ other method.
160
+ ```
161
+ * (maint) Always wait for Windows agent installs (c8cb9384)
162
+
163
+
164
+ ```
165
+ (maint) Always wait for Windows agent installs
166
+
167
+ When installing Windows agents with cygwin or any other means, always
168
+ prefer `start /w` over just calling msiexec.
169
+
170
+ This adds to what was first introduced in 9c32cac7a7a5bf.
171
+ ```
172
+ * Merge branch 'master' of github.com:bstopp/beaker (4452e5a9)
173
+
174
+ * Merge pull request #889 from spjmurray/bkr_401_os_volume_races (5c17bca4)
175
+
176
+
177
+ ```
178
+ Merge pull request #889 from spjmurray/bkr_401_os_volume_races
179
+
180
+ (BKR-401) fix race in OpenStack volume deletion
181
+ ```
182
+ * Merge pull request #892 from petems/maint_move_vb_vagrant_out_of_disk_path (17fe242f)
183
+
184
+
185
+ ```
186
+ Merge pull request #892 from petems/maint_move_vb_vagrant_out_of_disk_path
187
+
188
+ (maint) Moves various VB options out of `disk_path` logic
189
+ ```
190
+ * Merge pull request #812 from bodgit/openbsd (e37685d0)
191
+
192
+
193
+ ```
194
+ Merge pull request #812 from bodgit/openbsd
195
+
196
+ (BKR-249) Add OpenBSD support
197
+ ```
198
+ * Merge pull request #898 from kevpl/bkr415_acceptance_fix (888788a9)
199
+
200
+
201
+ ```
202
+ Merge pull request #898 from kevpl/bkr415_acceptance_fix
203
+
204
+ (BKR-415) re-targeted puppet_pkg acceptance from 3.7.5 -> 3.8.1
205
+ ```
206
+ * (BKR-415) re-targeted puppet_pkg acceptance from 3.7.5 -> 3.8.1 (c37cc8d7)
207
+
208
+ * This patch adds support for configuring the number of CPUs for (c3fae736)
209
+
210
+
211
+ ```
212
+ This patch adds support for configuring the number of CPUs for
213
+ vagrant VirtualBox instances. The `vagrant_cpus` config option is
214
+ used to set the value.
215
+ ```
216
+ * (BKR-417) This patch adds support for configuring the number of CPUs for (837fe37e)
217
+
218
+
219
+ ```
220
+ (BKR-417) This patch adds support for configuring the number of CPUs for
221
+ vagrant VirtualBox instances. The `vagrant_cpus` config option is
222
+ used to set the value.
223
+ ```
224
+ * (BKR-405) The "install_pe" DSL Method Fails to Install SG... (c31f2d9d)
225
+
226
+
227
+ ```
228
+ (BKR-405) The "install_pe" DSL Method Fails to Install SG...
229
+
230
+ ...if "Latest-win" Version File is Missing
231
+
232
+ - do not attempt to determine windows pe_ver if master version is
233
+ greater than 3.99, just inherit from the master (if it exists)
234
+ - there's probably more edge cases here, but I don't believe that
235
+ install_pe can handle every combinations of platforms/versions
236
+ ```
237
+ * (maint) Moves out of `disk_path` logic... (c8f98aa6)
238
+
239
+
240
+ ```
241
+ (maint) Moves out of `disk_path` logic...
242
+
243
+ Looks like these got moved into the `if` logic for `disk_path` accidentally around v2.8. This means that you can no longer use these options without adding disk_path logic in later versions of Beaker. This moves them back into their own section.
244
+ ```
245
+ * (BKR-401) fix race in OpenStack volume deletion (b93046ed)
246
+
247
+
248
+ ```
249
+ (BKR-401) fix race in OpenStack volume deletion
250
+
251
+ There is a delay between a volume being detached from a virtual machine and
252
+ when it is ready to be deleted. The code as it stands is likely to hit a 400
253
+ error as the volume is still in the 'detaching' state. Add in a wait_for
254
+ statement to allow the volume to get back into the 'available' state before
255
+ deleting
256
+ ```
257
+ * (BKR-326) Fixes FreeBSD install to use ports (a0d47d14)
258
+
259
+
260
+ ```
261
+ (BKR-326) Fixes FreeBSD install to use ports
262
+
263
+ * Adds helper method to `FreeBSD:Pkg` to install packages on FreeBSD using ports with sensible default arguments
264
+ ```
265
+ * (BKR-249) Add OpenBSD support (3f72ecfc)
266
+
267
+
268
+ ```
269
+ (BKR-249) Add OpenBSD support
270
+
271
+ Add install method to prefer installing the OpenBSD-maintained Puppet package
272
+ which tends to work better than vanilla gem versions. Also add enough smarts
273
+ to be able to do gem installations. The shell is not a login shell therefore
274
+ it doesn't pick up the .profile that contains the PKG_PATH variable so pkg_add
275
+ doesn't automatically install from the network so add the PKG_PATH to the
276
+ .ssh/environment too.
277
+
278
+ The packaging support handles the case when there are multiple rubies
279
+ available. Currently it will install the newest in the list that is older than
280
+ 2.2.x as that doesn't work with all versions of Puppet. Also, if installing the
281
+ package advises to create symlinks to make this package the default, perform
282
+ this step automatically. This handles for example when installing ruby-1.9.3
283
+ and all the commands have a 19 suffix, etc.
284
+ ```
285
+ ### <a name = "2.18.1">2.18.1 - 14 Jul, 2015 (6a82f99f)
286
+
287
+ * (HISTORY) update beaker history for gem release 2.18.1 (6a82f99f)
92
288
 
93
289
  * (GEM) update beaker version to 2.18.1 (f9939536)
94
290
 
@@ -1,10 +1,3 @@
1
1
  hosts.each do |host|
2
2
  install_puppet_from_gem(host, {:version => '3.7.5'})
3
-
4
- if host['platform'] =~ /sles/
5
- host.mkdir_p(host['puppetbindir'])
6
- ['facter', 'hiera', 'puppet'].each do |tool|
7
- on host, "ln -s /usr/bin/#{tool}.ruby* #{host['puppetbindir']}/#{tool}"
8
- end
9
- end
10
- end
3
+ end
@@ -1,7 +1,7 @@
1
1
  # the version is required on windows
2
2
  # all versions are required for osx
3
3
  install_puppet({
4
- :version => '3.7.5',
4
+ :version => '3.8.1',
5
5
  :facter_version => '2.1.0',
6
6
  :hiera_version => '1.3.4',
7
7
  })
@@ -197,7 +197,7 @@ module Beaker
197
197
  # @return a new {SedCommand} object
198
198
  def initialize platform, expression, filename, opts = {}
199
199
  command = "sed -i -e \"#{expression}\" #{filename}"
200
- if platform =~ /solaris|aix|osx/
200
+ if platform =~ /solaris|aix|osx|openbsd/
201
201
  command.slice! '-i '
202
202
  temp_file = opts[:temp_file] ? opts[:temp_file] : "#{filename}.tmp"
203
203
  command << " > #{temp_file} && mv #{temp_file} #{filename} && rm -f #{temp_file}"
@@ -623,13 +623,15 @@ module Beaker
623
623
  end
624
624
  end
625
625
 
626
- # The agent service is `pe-puppet` everywhere EXCEPT certain linux distros on PE 2.8
627
- # In all the case that it is different, this init script will exist. So we can assume
628
- # that if the script doesn't exist, we should just use `pe-puppet`
629
- agent_service = 'pe-puppet-agent'
630
- agent_service = 'pe-puppet' unless agent.file_exist?('/etc/init.d/pe-puppet-agent')
631
626
  # In 4.0 this was changed to just be `puppet`
632
- agent_service = 'puppet' unless version_is_less(agent['pe_ver'], '4.0')
627
+ agent_service = 'puppet'
628
+ if !aio_version?(agent)
629
+ # The agent service is `pe-puppet` everywhere EXCEPT certain linux distros on PE 2.8
630
+ # In all the case that it is different, this init script will exist. So we can assume
631
+ # that if the script doesn't exist, we should just use `pe-puppet`
632
+ agent_service = 'pe-puppet-agent'
633
+ agent_service = 'pe-puppet' unless agent.file_exist?('/etc/init.d/pe-puppet-agent')
634
+ end
633
635
 
634
636
  # Under a number of stupid circumstances, we can't stop the
635
637
  # agent using puppet. This is usually because of issues with
@@ -34,6 +34,21 @@ module Beaker
34
34
  'distmoduledir' => '/usr/local/etc/puppet/modules',
35
35
  'sitemoduledir' => '/usr/share/puppet/modules',
36
36
  },
37
+ 'openbsd' => {
38
+ 'puppetserver-confdir' => '/etc/puppetserver/conf.d',
39
+ 'puppetservice' => 'puppetmaster',
40
+ 'puppetpath' => '/etc/puppet/modules',
41
+ 'puppetvardir' => '/var/puppet',
42
+ 'puppetbin' => '/usr/local/bin/puppet',
43
+ 'puppetbindir' => '/usr/local/bin',
44
+ 'hieralibdir' => '/opt/puppet-git-repos/hiera/lib',
45
+ 'hierapuppetlibdir' => '/opt/puppet-git-repos/hiera-puppet/lib',
46
+ 'hierabindir' => '/opt/puppet-git-repos/hiera/bin',
47
+ 'hieradatadir' => '/etc/puppet/hieradata',
48
+ 'hieraconf' => '/etc/puppet/hiera.yaml',
49
+ 'distmoduledir' => '/etc/puppet/modules',
50
+ 'sitemoduledir' => '/usr/local/share/puppet/modules',
51
+ },
37
52
  'mac' => {
38
53
  'puppetserver-confdir' => '/etc/puppetserver/conf.d',
39
54
  'puppetservice' => 'puppetmaster',
@@ -123,6 +138,8 @@ module Beaker
123
138
  platform = 'unix'
124
139
  when /freebsd/
125
140
  platform = 'freebsd'
141
+ when /openbsd/
142
+ platform = 'openbsd'
126
143
  when /mac/
127
144
  platform = 'mac'
128
145
  when /pswindows/
@@ -155,6 +172,8 @@ module Beaker
155
172
  platform = 'unix'
156
173
  when /freebsd/
157
174
  platform = 'freebsd'
175
+ when /openbsd/
176
+ platform = 'openbsd'
158
177
  when /mac/
159
178
  platform = 'mac'
160
179
  when /pswindows/
@@ -242,6 +242,10 @@ module Beaker
242
242
  install_puppet_from_msi_on(host, opts)
243
243
  elsif host['platform'] =~ /osx/
244
244
  install_puppet_from_dmg_on(host, opts)
245
+ elsif host['platform'] =~ /openbsd/
246
+ install_puppet_from_openbsd_packages_on(host, opts)
247
+ elsif host['platform'] =~ /freebsd/
248
+ install_puppet_from_freebsd_ports_on(host, opts)
245
249
  else
246
250
  if opts[:default_action] == 'gem_install'
247
251
  opts[:version] ||= '~> 3.x'
@@ -293,9 +297,6 @@ module Beaker
293
297
  opts = FOSS_DEFAULT_DOWNLOAD_URLS.merge(opts)
294
298
  opts[:puppet_collection] ||= 'pc1' #hi! i'm case sensitive! be careful!
295
299
  opts[:puppet_agent_version] ||= opts[:version] #backwards compatability with old parameter name
296
- if not opts[:puppet_agent_version]
297
- raise "must provide :puppet_agent_version (puppet-agent version) for install_puppet_agent_on"
298
- end
299
300
 
300
301
  block_on hosts do |host|
301
302
  host[:type] = 'aio' #we are installing agent, so we want aio type
@@ -589,6 +590,31 @@ module Beaker
589
590
  end
590
591
  end
591
592
 
593
+ # Installs Puppet and dependencies from FreeBSD ports
594
+ #
595
+ # @param [Host, Array<Host>, String, Symbol] hosts One or more hosts to act upon,
596
+ # or a role (String or Symbol) that identifies one or more hosts.
597
+ # @param [Hash{Symbol=>String}] opts An options hash
598
+ # @option opts [String] :version The version of Puppet to install (shows warning)
599
+ #
600
+ # @return nil
601
+ # @api private
602
+ def install_puppet_from_freebsd_ports_on( hosts, opts )
603
+ if (opts[:version])
604
+ logger.warn "If you wish to choose a specific Puppet version, use `install_puppet_from_gem_on('~> 3.*')`"
605
+ end
606
+
607
+ block_on hosts do |host|
608
+ if host['platform'] =~ /freebsd-9/
609
+ host.install_package("puppet")
610
+ else
611
+ host.install_package("sysutils/puppet")
612
+ end
613
+ end
614
+
615
+ end
616
+ alias_method :install_puppet_from_freebsd_ports, :install_puppet_from_freebsd_ports_on
617
+
592
618
  # Installs Puppet and dependencies from dmg on provided host(s).
593
619
  #
594
620
  # @param [Host, Array<Host>, String, Symbol] hosts One or more hosts to act upon,
@@ -672,6 +698,26 @@ module Beaker
672
698
  end
673
699
  end
674
700
 
701
+ # Installs Puppet and dependencies from OpenBSD packages
702
+ #
703
+ # @param [Host, Array<Host>, String, Symbol] hosts The host to install packages on
704
+ # @param [Hash{Symbol=>String}] opts An options hash
705
+ # @option opts [String] :version The version of Puppet to install (shows warning)
706
+ #
707
+ # @return nil
708
+ # @api private
709
+ def install_puppet_from_openbsd_packages_on(hosts, opts)
710
+ if (opts[:version])
711
+ logger.warn "If you wish to choose a specific Puppet version, use `install_puppet_from_gem_on('~> 3.*')`"
712
+ end
713
+
714
+ block_on hosts do |host|
715
+ host.install_package('puppet')
716
+
717
+ configure_foss_defaults_on(host)
718
+ end
719
+ end
720
+
675
721
  # Installs Puppet and dependencies from gem on provided host(s)
676
722
  #
677
723
  # @param [Host, Array<Host>, String, Symbol] hosts One or more hosts to act upon,
@@ -707,6 +753,7 @@ module Beaker
707
753
  when /solaris-11/ then 'ruby-18'
708
754
  when /ubuntu-14/ then 'ruby'
709
755
  when /solaris-10|ubuntu|debian|el-|cumulus/ then 'rubygems'
756
+ when /openbsd/ then 'ruby'
710
757
  else
711
758
  raise "install_puppet() called with default_action " +
712
759
  "'gem_install' but program `gem' is " +
@@ -728,16 +775,18 @@ module Beaker
728
775
  on host, "echo '#{path_with_gem}' >> ~/.bashrc"
729
776
  end
730
777
 
778
+ gemflags = '--no-ri --no-rdoc --no-format-executable'
779
+
731
780
  if opts[:facter_version]
732
- on host, "gem install facter -v'#{opts[:facter_version]}' --no-ri --no-rdoc"
781
+ on host, "gem install facter -v'#{opts[:facter_version]}' #{gemflags}"
733
782
  end
734
783
 
735
784
  if opts[:hiera_version]
736
- on host, "gem install hiera -v'#{opts[:hiera_version]}' --no-ri --no-rdoc"
785
+ on host, "gem install hiera -v'#{opts[:hiera_version]}' #{gemflags}"
737
786
  end
738
787
 
739
788
  ver_cmd = opts[:version] ? "-v '#{opts[:version]}'" : ''
740
- on host, "gem install puppet #{ver_cmd} --no-ri --no-rdoc"
789
+ on host, "gem install puppet #{ver_cmd} #{gemflags}"
741
790
 
742
791
  # Similar to the treatment of 'gem' above.
743
792
  # This avoids adding /opt/csw/bin to PATH.
@@ -753,6 +802,12 @@ module Beaker
753
802
  on host, "ln -s #{gem_exec_dir}/facter /usr/bin/facter"
754
803
  on host, "ln -s #{gem_exec_dir}/puppet /usr/bin/puppet"
755
804
  end
805
+
806
+ # A gem install might not necessarily create these
807
+ ['confdir', 'logdir', 'codedir'].each do |key|
808
+ host.mkdir_p host.puppet[key] if host.puppet.has_key?(key)
809
+ end
810
+
756
811
  configure_foss_defaults_on( host )
757
812
  end
758
813
  end
@@ -1094,10 +1149,10 @@ module Beaker
1094
1149
  def install_puppet_agent_pe_promoted_repo_on( hosts, opts )
1095
1150
  opts[:puppet_agent_version] ||= 'latest'
1096
1151
  block_on hosts do |host|
1097
- pe_ver = host[:pe_ver] || opts[:pe_ver] || '4.0'
1152
+ pe_ver = host[:pe_ver] || opts[:pe_ver] || '4.0.0-rc1'
1098
1153
  variant, version, arch, codename = host['platform'].to_array
1099
1154
  opts = FOSS_DEFAULT_DOWNLOAD_URLS.merge(opts)
1100
- opts[:download_url] = "#{opts[:pe_promoted_builds_url]}/puppet-agent/#{ pe_ver }/#{ opts[:puppet_agent_version] }/repos/"
1155
+ opts[:download_url] = "#{opts[:pe_promoted_builds_url]}/puppet-agent/#{ pe_ver }/#{ opts[:puppet_agent_version] }/repos"
1101
1156
  opts[:copy_base_local] ||= File.join('tmp', 'repo_configs')
1102
1157
  opts[:copy_dir_external] ||= File.join('/', 'root')
1103
1158
  opts[:puppet_collection] ||= 'PC1'
@@ -1126,7 +1181,7 @@ module Beaker
1126
1181
  # - we do not have install_32 set on host
1127
1182
  # - we do not have install_32 set globally
1128
1183
  arch_suffix = should_install_64bit ? '64' : '86'
1129
- release_path += "windows/"
1184
+ release_path += "/windows/"
1130
1185
  release_file = "/puppet-agent-x#{arch_suffix}.msi"
1131
1186
  download_file = "puppet-agent-x#{arch_suffix}.msi"
1132
1187
  when /^osx$/
@@ -93,7 +93,7 @@ module Beaker
93
93
  def add_pe_defaults_on(hosts)
94
94
  block_on hosts do | host |
95
95
  case host.class.to_s.downcase
96
- when /aix|freebsd|unix/
96
+ when /aix|(free|open)bsd|unix/
97
97
  platform = 'unix'
98
98
  when /mac/
99
99
  platform = 'mac'
@@ -123,10 +123,8 @@ module Beaker
123
123
  def remove_pe_defaults_on(hosts)
124
124
  block_on hosts do | host |
125
125
  case host.class.to_s.downcase
126
- when /aix|unix/
126
+ when /aix|(free|open)bsd|unix/
127
127
  platform = 'unix'
128
- when /freebsd/
129
- platform = 'freebsd'
130
128
  when /mac/
131
129
  platform = 'mac'
132
130
  when /pswindows/
@@ -95,12 +95,11 @@ module Beaker
95
95
  version = host['pe_ver'] || opts[:pe_ver]
96
96
  if host['platform'] =~ /windows/
97
97
  log_file = "#{File.basename(host['working_dir'])}.log"
98
- pe_debug = host[:pe_debug] || opts[:pe_debug] ? " && cat #{log_file}" : ''
99
- if host.is_cygwin?
100
- "cd #{host['working_dir']} && cmd /C 'start /w msiexec.exe /qn /L*V #{log_file} /i #{host['dist']}.msi PUPPET_MASTER_SERVER=#{master} PUPPET_AGENT_CERTNAME=#{host}'#{pe_debug}"
101
- else
102
- "cd #{host['working_dir']} && msiexec.exe /qn /L*V #{log_file} /i #{host['dist']}.msi PUPPET_MASTER_SERVER=#{master} PUPPET_AGENT_CERTNAME=#{host}#{pe_debug}"
103
- end
98
+ # cat may not be available with strictly Windows environments
99
+ # Prefer `type` as an alternative to `cat` if non-cygwin
100
+ win_cat = host.is_cygwin? ? "cat" : "type"
101
+ pe_debug = host[:pe_debug] || opts[:pe_debug] ? " && #{win_cat} #{log_file}" : ''
102
+ "cd #{host['working_dir']} && cmd /C 'start /w msiexec.exe /qn /L*V #{log_file} /i #{host['dist']}.msi PUPPET_MASTER_SERVER=#{master} PUPPET_AGENT_CERTNAME=#{host}'#{pe_debug}"
104
103
  # Frictionless install didn't exist pre-3.2.0, so in that case we fall
105
104
  # through and do a regular install.
106
105
  elsif host['roles'].include? 'frictionless' and ! version_is_less(version, '3.2.0')
@@ -344,6 +343,7 @@ module Beaker
344
343
  # @option opts [Boolean] :fetch_local_then_push_to_host determines whether
345
344
  # you use Beaker as the middleman for this (true), or curl the
346
345
  # file from the host (false; default behavior)
346
+ # @option opts [Boolean] :masterless Are we performing a masterless installation?
347
347
  #
348
348
  # @example
349
349
  # do_install(hosts, {:type => :upgrade, :pe_dir => path, :pe_ver => version, :pe_ver_win => version_win})
@@ -354,8 +354,7 @@ module Beaker
354
354
  # @api private
355
355
  #
356
356
  def do_install hosts, opts = {}
357
- masterless = (defined? options) ? options[:masterless] : false
358
- opts[:masterless] = masterless # has to pass masterless down for answer generation awareness
357
+ masterless = opts[:masterless]
359
358
  opts[:type] = opts[:type] || :install
360
359
  unless masterless
361
360
  pre30database = version_is_less(opts[:pe_ver] || database['pe_ver'], '3.0')
@@ -416,10 +415,10 @@ module Beaker
416
415
  install_hosts.each do |host|
417
416
  if agent_only_check_needed && hosts_agent_only.include?(host)
418
417
  host['type'] = 'aio'
419
- install_puppet_agent_pe_promoted_repo_on(host, { :puppet_agent_version => opts[:puppet_agent_version],
420
- :puppet_agent_sha => opts[:puppet_agent_sha],
421
- :pe_ver => opts[:pe_ver],
422
- :puppet_collection => opts[:puppet_collection] })
418
+ install_puppet_agent_pe_promoted_repo_on(host, { :puppet_agent_version => host[:puppet_agent_version] || opts[:puppet_agent_version],
419
+ :puppet_agent_sha => host[:puppet_agent_sha] || opts[:puppet_agent_sha],
420
+ :pe_ver => host[:pe_ver] || opts[:pe_ver],
421
+ :puppet_collection => host[:puppet_collection] || opts[:puppet_collection] })
423
422
  setup_defaults_and_config_helper_on(host, master, [0, 1])
424
423
  elsif host['platform'] =~ /windows/
425
424
  on host, installer_cmd(host, opts)
@@ -555,9 +554,10 @@ module Beaker
555
554
  # @param [Host, Array<Host>, String, Symbol] hosts One or more hosts to act upon,
556
555
  # or a role (String or Symbol) that identifies one or more hosts.
557
556
  # @!macro common_opts
557
+ # @option opts [Boolean] :masterless Are we performing a masterless installation?
558
558
  # @option opts [String] :puppet_agent_version Version of puppet-agent to install. Required for PE agent
559
559
  # only hosts on 4.0+
560
- # @option opts [String] :puppet_agent_sha The sha of puppet-agent to install, defaults to puppet-agent-version.
560
+ # @option opts [String] :puppet_agent_sha The sha of puppet-agent to install, defaults to puppet_agent_version.
561
561
  # Required for PE agent only hosts on 4.0+
562
562
  # @option opts [String] :pe_ver The version of PE (will also use host['pe_ver']), defaults to '4.0'
563
563
  # @option opts [String] :puppet_collection The puppet collection for puppet-agent install.
@@ -572,14 +572,19 @@ module Beaker
572
572
  def install_pe_on(hosts, opts)
573
573
  #process the version files if necessary
574
574
  confine_block(:to, {}, hosts) do
575
- hosts.each do |host|
575
+ sorted_hosts.each do |host|
576
576
  host['pe_dir'] ||= opts[:pe_dir]
577
577
  if host['platform'] =~ /windows/
578
- host['pe_ver'] = host['pe_ver'] || opts['pe_ver'] ||
579
- Beaker::Options::PEVersionScraper.load_pe_version(host[:pe_dir] || opts[:pe_dir], opts[:pe_version_file_win])
578
+ # we don't need the pe_version if:
579
+ # * master pe_ver > 4.0
580
+ if not (!opts[:masterless] && master[:pe_ver] && !version_is_less(master[:pe_ver], '3.99'))
581
+ host['pe_ver'] ||= Beaker::Options::PEVersionScraper.load_pe_version(host[:pe_dir] || opts[:pe_dir], opts[:pe_version_file_win])
582
+ else
583
+ # inherit the master's version
584
+ host['pe_ver'] ||= master[:pe_ver]
585
+ end
580
586
  else
581
- host['pe_ver'] = host['pe_ver'] || opts['pe_ver'] ||
582
- Beaker::Options::PEVersionScraper.load_pe_version(host[:pe_dir] || opts[:pe_dir], opts[:pe_version_file])
587
+ host['pe_ver'] ||= Beaker::Options::PEVersionScraper.load_pe_version(host[:pe_dir] || opts[:pe_dir], opts[:pe_version_file])
583
588
  end
584
589
  end
585
590
  do_install sorted_hosts, opts
data/lib/beaker/host.rb CHANGED
@@ -20,6 +20,14 @@ module Beaker
20
20
  @command = command
21
21
  end
22
22
 
23
+ def has_key?(k)
24
+ cmd = PuppetCommand.new(@command, '--configprint all')
25
+ keys = @host.exec(cmd).stdout.split("\n").collect do |x|
26
+ x[/^[^\s]+/]
27
+ end
28
+ keys.include?(k)
29
+ end
30
+
23
31
  def [](k)
24
32
  cmd = PuppetCommand.new(@command, "--configprint #{k.to_s}")
25
33
  @host.exec(cmd).stdout.strip
@@ -457,12 +465,12 @@ module Beaker
457
465
  end
458
466
 
459
467
  [
460
- 'unix',
461
- 'aix',
462
- 'mac',
463
- 'freebsd',
464
- 'windows',
465
- 'pswindows',
468
+ 'unix',
469
+ 'aix',
470
+ 'mac',
471
+ 'freebsd',
472
+ 'windows',
473
+ 'pswindows',
466
474
  ].each do |lib|
467
475
  require "beaker/host/#{lib}"
468
476
  end
@@ -7,11 +7,13 @@ module FreeBSD
7
7
 
8
8
  [
9
9
  'exec',
10
+ 'pkg',
10
11
  ].each do |lib|
11
12
  require "beaker/host/freebsd/#{lib}"
12
13
  end
13
14
 
14
15
  include FreeBSD::Exec
16
+ include FreeBSD::Pkg
15
17
 
16
18
  def platform_defaults
17
19
  h = Beaker::Options::OptionsHash.new
@@ -0,0 +1,18 @@
1
+ module FreeBSD::Pkg
2
+ include Beaker::CommandFactory
3
+
4
+ def install_package(name, cmdline_args = nil, opts = {})
5
+ case self['platform']
6
+ when /freebsd-9/
7
+ cmdline_args ||= '-rF'
8
+ result = execute("pkg_add #{cmdline_args} #{name}", opts) { |result| result }
9
+ when /freebsd-10/
10
+ cmdline_args ||= '-y'
11
+ result = execute("pkg install #{cmdline_args} #{name}", opts) { |result| result }
12
+ else
13
+ raise "Package #{name} could not be installed on #{self}"
14
+ end
15
+ result.exit_code == 0
16
+ end
17
+
18
+ end
@@ -102,11 +102,11 @@ module Unix::Exec
102
102
  env_file = self[:ssh_env_file]
103
103
  escaped_val = Regexp.escape(val).gsub('/', '\/').gsub(';', '\;')
104
104
  #see if the key/value pair already exists
105
- if exec(Beaker::Command.new("grep #{key}=.*#{escaped_val} #{env_file}"), :accept_all_exit_codes => true ).exit_code == 0
105
+ if exec(Beaker::Command.new("grep ^#{key}=.*#{escaped_val} #{env_file}"), :accept_all_exit_codes => true ).exit_code == 0
106
106
  return #nothing to do here, key value pair already exists
107
107
  #see if the key already exists
108
- elsif exec(Beaker::Command.new("grep #{key} #{env_file}"), :accept_all_exit_codes => true ).exit_code == 0
109
- exec(Beaker::SedCommand.new(self['platform'], "s/#{key}=/#{key}=#{escaped_val}:/", env_file))
108
+ elsif exec(Beaker::Command.new("grep ^#{key} #{env_file}"), :accept_all_exit_codes => true ).exit_code == 0
109
+ exec(Beaker::SedCommand.new(self['platform'], "s/^#{key}=/#{key}=#{escaped_val}:/", env_file))
110
110
  else
111
111
  exec(Beaker::Command.new("echo \"#{key}=#{val}\" >> #{env_file}"))
112
112
  end
@@ -40,6 +40,8 @@ module Unix::Pkg
40
40
  result = execute("pkg_info #{name}", opts) { |result| result }
41
41
  when /freebsd-10/
42
42
  result = execute("pkg info #{name}", opts) { |result| result }
43
+ when /openbsd/
44
+ result = execute("pkg_info #{name}", opts) { |result| result }
43
45
  else
44
46
  raise "Package #{name} cannot be queried on #{self}"
45
47
  end
@@ -82,6 +84,32 @@ module Unix::Pkg
82
84
  execute("pkg_add -fr #{cmdline_args} #{name}", opts)
83
85
  when /freebsd-10/
84
86
  execute("pkg #{cmdline_args} install #{name}", opts)
87
+ when /openbsd/
88
+ begin
89
+ execute("pkg_add -I #{cmdline_args} #{name}", opts) do |command|
90
+ # Handles where there are multiple rubies, installs the latest one
91
+ if command.stderr =~ /^Ambiguous: #{name} could be (.+)$/
92
+ name = $1.chomp.split(' ').collect { |x|
93
+ x =~ /-(\d[^-p]+)/
94
+ [x, $1]
95
+ }.select { |x|
96
+ # Blacklist Ruby 2.2.0+ for the sake of Puppet 3.x
97
+ Gem::Version.new(x[1]) < Gem::Version.new('2.2.0')
98
+ }.sort { |a,b|
99
+ Gem::Version.new(b[1]) <=> Gem::Version.new(a[1])
100
+ }.collect { |x|
101
+ x[0]
102
+ }.first
103
+ raise ArgumentException
104
+ end
105
+ # If the package advises symlinks to be created, do it
106
+ command.stdout.split(/\n/).select { |x| x =~ /^\s+ln\s/ }.each do |ln|
107
+ execute(ln, opts)
108
+ end
109
+ end
110
+ rescue
111
+ retry
112
+ end
85
113
  else
86
114
  raise "Package #{name} cannot be installed on #{self}"
87
115
  end
@@ -14,6 +14,7 @@ module Beaker
14
14
  TRIES = 5
15
15
  UNIX_PACKAGES = ['curl', 'ntpdate']
16
16
  FREEBSD_PACKAGES = ['curl', 'perl5']
17
+ OPENBSD_PACKAGES = ['curl']
17
18
  WINDOWS_PACKAGES = ['curl']
18
19
  PSWINDOWS_PACKAGES = []
19
20
  SLES10_PACKAGES = ['curl']
@@ -103,6 +104,8 @@ module Beaker
103
104
  check_and_install_packages_if_needed(host, PSWINDOWS_PACKAGES)
104
105
  when host['platform'] =~ /freebsd/
105
106
  check_and_install_packages_if_needed(host, FREEBSD_PACKAGES)
107
+ when host['platform'] =~ /openbsd/
108
+ check_and_install_packages_if_needed(host, OPENBSD_PACKAGES)
106
109
  when host['platform'] !~ /debian|aix|solaris|windows|sles-|osx-|cumulus|f5-/
107
110
  check_and_install_packages_if_needed(host, UNIX_PACKAGES)
108
111
  end
@@ -319,6 +322,8 @@ module Beaker
319
322
  host.exec(Command.new('sudo cp -r .ssh /var/root/.'), {:pty => true})
320
323
  elsif host['platform'] =~ /freebsd/
321
324
  host.exec(Command.new('sudo cp -r .ssh /root/.'), {:pty => true})
325
+ elsif host['platform'] =~ /openbsd/
326
+ host.exec(Command.new('sudo cp -r .ssh /root/.'), {:pty => true})
322
327
  else
323
328
  host.exec(Command.new('sudo su -c "cp -r .ssh /root/."'), {:pty => true})
324
329
  end
@@ -359,6 +364,8 @@ module Beaker
359
364
  host.exec(Command.new("sudo sed -i '' 's/#PermitRootLogin yes/PermitRootLogin Yes/g' /etc/sshd_config"))
360
365
  elsif host['platform'] =~ /freebsd/
361
366
  host.exec(Command.new("sudo sed -i -e 's/#PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config"), {:pty => true} )
367
+ elsif host['platform'] =~ /openbsd/
368
+ host.exec(Command.new("sudo perl -pi -e 's/^PermitRootLogin no/PermitRootLogin yes/' /etc/ssh/sshd_config"), {:pty => true} )
362
369
  elsif not host.is_powershell?
363
370
  host.exec(Command.new("sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\""), {:pty => true})
364
371
  else
@@ -371,7 +378,7 @@ module Beaker
371
378
  host.exec(Command.new("sudo -E systemctl restart sshd.service"), {:pty => true})
372
379
  elsif host['platform'] =~ /centos|el-|redhat|fedora|eos/
373
380
  host.exec(Command.new("sudo -E /sbin/service sshd reload"), {:pty => true})
374
- elsif host['platform'] =~ /freebsd/
381
+ elsif host['platform'] =~ /(free|open)bsd/
375
382
  host.exec(Command.new("sudo /etc/rc.d/sshd restart"))
376
383
  else
377
384
  logger.warn("Attempting to update ssh on non-supported platform: #{host.name}: #{host['platform']}")
@@ -520,7 +527,7 @@ module Beaker
520
527
  host.exec(Command.new("echo '\nPermitUserEnvironment yes' >> /etc/ssh/sshd_config"))
521
528
  host.exec(Command.new("stopsrc -g ssh"))
522
529
  host.exec(Command.new("startsrc -g ssh"))
523
- when /freebsd/
530
+ when /(free|open)bsd/
524
531
  host.exec(Command.new("sudo perl -pi -e 's/^#?PermitUserEnvironment no/PermitUserEnvironment yes/' /etc/ssh/sshd_config"), {:pty => true} )
525
532
  host.exec(Command.new("sudo /etc/rc.d/sshd restart"))
526
533
  end
@@ -532,6 +539,13 @@ module Beaker
532
539
  host.exec(Command.new("touch #{host[:ssh_env_file]}"))
533
540
  #add the constructed env vars to this host
534
541
  host.add_env_var('PATH', '$PATH')
542
+ # FIXME
543
+ if host['platform'] =~ /openbsd-(\d)\.?(\d)-(.+)/
544
+ version = "#{$1}.#{$2}"
545
+ arch = $3
546
+ arch = 'amd64' if ['x64', 'x86_64'].include?(arch)
547
+ host.add_env_var('PKG_PATH', "http://ftp.openbsd.org/pub/OpenBSD/#{version}/packages/#{arch}/")
548
+ end
535
549
  end
536
550
  #add the env var set to this test host
537
551
  env.each_pair do |var, value|
@@ -153,6 +153,7 @@ module Beaker
153
153
  vm.volumes.each do |vol|
154
154
  @logger.debug "Deleting volume #{vol.name} for OpenStack host #{vm.name}"
155
155
  vm.detach_volume(vol.id)
156
+ vol.wait_for { ready? }
156
157
  vol.destroy
157
158
  end
158
159
  end
@@ -18,7 +18,7 @@ class Beaker::VagrantVirtualbox < Beaker::Vagrant
18
18
  def self.provider_vfile_section(host, options)
19
19
  provider_section = ""
20
20
  provider_section << " v.vm.provider :virtualbox do |vb|\n"
21
- provider_section << " vb.customize ['modifyvm', :id, '--memory', '#{options['vagrant_memsize'] ||= '1024'}']\n"
21
+ provider_section << " vb.customize ['modifyvm', :id, '--memory', '#{options['vagrant_memsize'] ||= '1024'}', '--cpus', '#{options['vagrant_cpus'] ||= '1'}']\n"
22
22
  provider_section << " vb.vbguest.auto_update = false" if options[:vbguest_plugin] == 'disable'
23
23
 
24
24
  # Guest volume support
@@ -52,17 +52,22 @@ class Beaker::VagrantVirtualbox < Beaker::Vagrant
52
52
  end
53
53
  end
54
54
 
55
+ provider_section << " vb.customize [\"modifyvm\", :id, \"--natdnshostresolver1\", \"#{host['natdns']}\"]\n" unless host['natdns'].nil?
56
+
57
+ provider_section << " vb.customize [\"modifyvm\", :id, \"--natdnsproxy1\", \"#{host['natdns']}\"]\n" unless host['natdns'].nil?
58
+
59
+ provider_section << " vb.gui = true\n" unless host['vb_gui'].nil?
60
+
61
+ provider_section << " [\"modifyvm\", :id, \"--cpuidset\", \"1\",\"000206a7\",\"02100800\",\"1fbae3bf\",\"bfebfbff\"\]" if /osx/i.match(host['platform'])
62
+
55
63
  if host['disk_path']
56
64
  unless File.exist?(host['disk_path'])
57
65
  host['disk_path'] = File.join(host['disk_path'], "#{host.name}.vmdk")
58
66
  provider_section << " vb.customize ['createhd', '--filename', '#{host['disk_path']}', '--size', #{host['disk_size'] ||= 5 * 1024}, '--format', 'vmdk']\n"
59
67
  end
60
68
  provider_section << " vb.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--medium','#{host['disk_path']}']\n"
61
- provider_section << " vb.customize [\"modifyvm\", :id, \"--natdnshostresolver1\", \"#{host['natdns']}\"]\n" unless host['natdns'].nil?
62
- provider_section << " vb.customize [\"modifyvm\", :id, \"--natdnsproxy1\", \"#{host['natdns']}\"]\n" unless host['natdns'].nil?
63
- provider_section << " vb.gui = true\n" unless host['vb_gui'].nil?
64
- provider_section << " [\"modifyvm\", :id, \"--cpuidset\", \"1\",\"000206a7\",\"02100800\",\"1fbae3bf\",\"bfebfbff\"\]" if /osx/i.match(host['platform'])
65
69
  end
70
+
66
71
  provider_section << " end\n"
67
72
 
68
73
  provider_section
@@ -3,7 +3,7 @@ module Beaker
3
3
  # all String methods while adding several platform-specific use cases.
4
4
  class Platform < String
5
5
  # Supported platforms
6
- PLATFORMS = /^(cisco|freebsd|osx|centos|fedora|debian|oracle|redhat|scientific|sles|ubuntu|windows|solaris|aix|el|eos|cumulus|f5)\-.+\-.+$/
6
+ PLATFORMS = /^(cisco|(free|open)bsd|osx|centos|fedora|debian|oracle|redhat|scientific|sles|ubuntu|windows|solaris|aix|el|eos|cumulus|f5)\-.+\-.+$/
7
7
 
8
8
  # Platform version numbers vs. codenames conversion hash
9
9
  PLATFORM_VERSION_CODES =
@@ -44,6 +44,8 @@ module Beaker
44
44
  # Creates the Platform object. Checks to ensure that the platform String
45
45
  # provided meets the platform formatting rules. Platforms name must be of
46
46
  # the format /^OSFAMILY-VERSION-ARCH.*$/ where OSFAMILY is one of:
47
+ # * freebsd
48
+ # * openbsd
47
49
  # * osx
48
50
  # * centos
49
51
  # * fedora
@@ -1,5 +1,5 @@
1
1
  module Beaker
2
2
  module Version
3
- STRING = '2.18.1'
3
+ STRING = '2.18.2'
4
4
  end
5
5
  end
@@ -394,7 +394,6 @@ describe ClassMixedWithDSLHelpers do
394
394
  allow( el_agent ).to receive( :puppet ).and_return( { 'vardir' => vardir } )
395
395
 
396
396
  expect( el_agent ).to receive( :file_exist? ).with("/var/state/agent_catalog_run.lock").and_return(false)
397
- expect( el_agent ).to receive( :file_exist? ).with("/etc/init.d/pe-puppet-agent").and_return(true)
398
397
 
399
398
  expect( subject ).to receive( :puppet_resource ).with( "service", "puppet", "ensure=stopped").once
400
399
  expect( subject ).to receive( :on ).once
@@ -37,6 +37,12 @@ describe ClassMixedWithDSLInstallUtils do
37
37
  let(:machost) { make_host( 'machost', { :platform => 'osx-10.9-x86_64',
38
38
  :pe_ver => '3.0',
39
39
  :working_dir => '/tmp' } ) }
40
+ let(:freebsdhost9) { make_host( 'freebsdhost9', { :platform => 'freebsd-9-x64',
41
+ :pe_ver => '3.0',
42
+ :working_dir => '/tmp' } ) }
43
+ let(:freebsdhost10) { make_host( 'freebsdhost10', { :platform => 'freebsd-10-x64',
44
+ :pe_ver => '3.0',
45
+ :working_dir => '/tmp' } ) }
40
46
  let(:unixhost) { make_host( 'unixhost', { :platform => 'linux',
41
47
  :pe_ver => '3.0',
42
48
  :working_dir => '/tmp',
@@ -154,6 +160,20 @@ describe ClassMixedWithDSLInstallUtils do
154
160
  end
155
161
  end
156
162
 
163
+ context 'install_puppet_from_freebsd_ports_on' do
164
+ it 'installs puppet on FreeBSD 9' do
165
+ expect(freebsdhost9).to receive(:install_package).with('puppet')
166
+
167
+ subject.install_puppet_from_freebsd_ports_on( freebsdhost9, {} )
168
+ end
169
+
170
+ it 'installs puppet on FreeBSD 10' do
171
+ expect(freebsdhost10).to receive(:install_package).with('sysutils/puppet')
172
+
173
+ subject.install_puppet_from_freebsd_ports_on( freebsdhost10, {} )
174
+ end
175
+ end
176
+
157
177
  context 'install_puppet_from_msi' do
158
178
 
159
179
  it 'installs puppet on cygwin windows' do
@@ -394,9 +394,9 @@ describe ClassMixedWithDSLInstallUtils do
394
394
  :pe_ver => '3.0',
395
395
  :roles => ['agent']
396
396
  }, 1)
397
+ opts[:masterless] = true
397
398
 
398
399
  allow( subject ).to receive( :hosts ).and_return( hosts )
399
- allow( subject ).to receive( :options ).and_return({ :masterless => true })
400
400
  allow( subject ).to receive( :on ).and_return( Beaker::Result.new( {}, '' ) )
401
401
  allow( subject ).to receive( :fetch_pe ).and_return( true )
402
402
  allow( subject ).to receive( :create_remote_file ).and_return( true )
@@ -454,9 +454,9 @@ describe ClassMixedWithDSLInstallUtils do
454
454
  #run installer on all hosts
455
455
  expect( subject ).to receive( :on ).with( hosts[0], /puppet-enterprise-installer/ ).once
456
456
  expect( subject ).to receive( :install_puppet_agent_pe_promoted_repo_on ).with( hosts[1],
457
- {:puppet_agent_version=>nil, :puppet_agent_sha=>nil, :pe_ver=>nil, :puppet_collection=>nil} ).once
457
+ {:puppet_agent_version=>nil, :puppet_agent_sha=>nil, :pe_ver=>hosts[1][:pe_ver], :puppet_collection=>nil} ).once
458
458
  expect( subject ).to receive( :install_puppet_agent_pe_promoted_repo_on ).with( hosts[2],
459
- {:puppet_agent_version=>nil, :puppet_agent_sha=>nil, :pe_ver=>nil, :puppet_collection=>nil} ).once
459
+ {:puppet_agent_version=>nil, :puppet_agent_sha=>nil, :pe_ver=>hosts[2][:pe_ver], :puppet_collection=>nil} ).once
460
460
  hosts.each do |host|
461
461
  expect( subject ).to receive( :add_aio_defaults_on ).with( host ).once
462
462
  expect( subject ).to receive( :sign_certificate_for ).with( host ).once
@@ -510,7 +510,7 @@ describe ClassMixedWithDSLInstallUtils do
510
510
  #run installer on all hosts
511
511
  expect( subject ).to receive( :on ).with( hosts[0], /puppet-enterprise-installer/ ).once
512
512
  expect( subject ).to receive( :install_puppet_agent_pe_promoted_repo_on ).with( hosts[1],
513
- {:puppet_agent_version=>nil, :puppet_agent_sha=>nil, :pe_ver=>nil, :puppet_collection=>nil} ).once
513
+ {:puppet_agent_version=>nil, :puppet_agent_sha=>nil, :pe_ver=>hosts[1][:pe_ver], :puppet_collection=>nil} ).once
514
514
  expect( subject ).to receive( :on ).with( hosts[2], /puppet-enterprise-installer/ ).once
515
515
  hosts.each do |host|
516
516
  if subject.aio_version?(host)
@@ -186,7 +186,7 @@ module Beaker
186
186
  it "does nothing if the key/value pair already exists" do
187
187
  result = Beaker::Result.new(host, '')
188
188
  result.exit_code = 0
189
- expect( Beaker::Command ).to receive(:new).with("grep KEY=.*\\/my\\/first\\/value ~/.ssh/environment")
189
+ expect( Beaker::Command ).to receive(:new).with("grep ^KEY=.*\\/my\\/first\\/value ~/.ssh/environment")
190
190
  expect( host ).to receive(:exec).once.and_return(result)
191
191
 
192
192
  host.add_env_var('key', '/my/first/value')
@@ -195,9 +195,9 @@ module Beaker
195
195
  it "adds new line to environment file if no env var of that name already exists" do
196
196
  result = Beaker::Result.new(host, '')
197
197
  result.exit_code = 1
198
- expect( Beaker::Command ).to receive(:new).with("grep KEY=.*\\/my\\/first\\/value ~/.ssh/environment")
198
+ expect( Beaker::Command ).to receive(:new).with("grep ^KEY=.*\\/my\\/first\\/value ~/.ssh/environment")
199
199
  expect( host ).to receive(:exec).and_return(result)
200
- expect( Beaker::Command ).to receive(:new).with(/grep KEY ~\/\.ssh\/environment/)
200
+ expect( Beaker::Command ).to receive(:new).with(/grep \^KEY ~\/\.ssh\/environment/)
201
201
  expect( host ).to receive(:exec).and_return(result)
202
202
  expect( Beaker::Command ).to receive(:new).with("echo \"KEY=/my/first/value\" >> ~/.ssh/environment")
203
203
  host.add_env_var('key', '/my/first/value')
@@ -206,13 +206,13 @@ module Beaker
206
206
  it "updates existing line in environment file when adding additional value to existing variable" do
207
207
  result = Beaker::Result.new(host, '')
208
208
  result.exit_code = 1
209
- expect( Beaker::Command ).to receive(:new).with("grep KEY=.*\\/my\\/first\\/value ~/.ssh/environment")
209
+ expect( Beaker::Command ).to receive(:new).with("grep ^KEY=.*\\/my\\/first\\/value ~/.ssh/environment")
210
210
  expect( host ).to receive(:exec).and_return(result)
211
211
  result = Beaker::Result.new(host, '')
212
212
  result.exit_code = 0
213
- expect( Beaker::Command ).to receive(:new).with(/grep KEY ~\/\.ssh\/environment/)
213
+ expect( Beaker::Command ).to receive(:new).with(/grep \^KEY ~\/\.ssh\/environment/)
214
214
  expect( host ).to receive(:exec).and_return(result)
215
- expect( Beaker::SedCommand ).to receive(:new).with('unix', 's/KEY=/KEY=\\/my\\/first\\/value:/', '~/.ssh/environment')
215
+ expect( Beaker::SedCommand ).to receive(:new).with('unix', 's/^KEY=/KEY=\\/my\\/first\\/value:/', '~/.ssh/environment')
216
216
  host.add_env_var('key', '/my/first/value')
217
217
  end
218
218
 
@@ -42,7 +42,7 @@ Vagrant.configure("2") do |c|
42
42
  v.vm.box_check_update = 'true'
43
43
  v.vm.network :private_network, ip: "ip.address.for.vm1", :netmask => "255.255.0.0", :mac => "0123456789"
44
44
  v.vm.provider :virtualbox do |vb|
45
- vb.customize ['modifyvm', :id, '--memory', '1024']
45
+ vb.customize ['modifyvm', :id, '--memory', '1024', '--cpus', '1']
46
46
  end
47
47
  end
48
48
  c.vm.define 'vm2' do |v|
@@ -52,7 +52,7 @@ Vagrant.configure("2") do |c|
52
52
  v.vm.box_check_update = 'true'
53
53
  v.vm.network :private_network, ip: "ip.address.for.vm2", :netmask => "255.255.0.0", :mac => "0123456789"
54
54
  v.vm.provider :virtualbox do |vb|
55
- vb.customize ['modifyvm', :id, '--memory', '1024']
55
+ vb.customize ['modifyvm', :id, '--memory', '1024', '--cpus', '1']
56
56
  end
57
57
  end
58
58
  c.vm.define 'vm3' do |v|
@@ -62,7 +62,7 @@ Vagrant.configure("2") do |c|
62
62
  v.vm.box_check_update = 'true'
63
63
  v.vm.network :private_network, ip: "ip.address.for.vm3", :netmask => "255.255.0.0", :mac => "0123456789"
64
64
  v.vm.provider :virtualbox do |vb|
65
- vb.customize ['modifyvm', :id, '--memory', '1024']
65
+ vb.customize ['modifyvm', :id, '--memory', '1024', '--cpus', '1']
66
66
  end
67
67
  end
68
68
  end
@@ -120,11 +120,25 @@ EOF
120
120
 
121
121
  generated_file = File.read( File.expand_path( File.join( path, "Vagrantfile") ) )
122
122
 
123
- match = generated_file.match(/vb.customize \['modifyvm', :id, '--memory', 'hello!'\]/)
123
+ match = generated_file.match(/vb.customize \['modifyvm', :id, '--memory', 'hello!', '--cpus', '1'\]/)
124
124
 
125
125
  expect( match ).to_not be nil
126
126
 
127
127
  end
128
+
129
+ it "uses the cpus defined per vagrant host" do
130
+ path = vagrant.instance_variable_get( :@vagrant_path )
131
+ allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
132
+
133
+ vagrant.make_vfile( @hosts, {'vagrant_cpus' => 'goodbye!'} )
134
+
135
+ generated_file = File.read( File.expand_path( File.join( path, "Vagrantfile") ) )
136
+
137
+ match = generated_file.match(/vb.customize \['modifyvm', :id, '--memory', '1024', '--cpus', 'goodbye!'\]/)
138
+
139
+ expect( match ).to_not be nil
140
+
141
+ end
128
142
 
129
143
  it "can generate a new /etc/hosts file referencing each host" do
130
144
 
@@ -27,7 +27,7 @@ describe Beaker::VagrantVirtualbox do
27
27
  vagrant.make_vfile( @hosts )
28
28
 
29
29
  vagrantfile = File.read( File.expand_path( File.join( path, 'Vagrantfile' )))
30
- expect( vagrantfile ).to include( %Q{ v.vm.provider :virtualbox do |vb|\n vb.customize ['modifyvm', :id, '--memory', '1024']\n end})
30
+ expect( vagrantfile ).to include( %Q{ v.vm.provider :virtualbox do |vb|\n vb.customize ['modifyvm', :id, '--memory', '1024', '--cpus', '1']\n end})
31
31
  end
32
32
 
33
33
  it "can disable the vb guest plugin" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.18.1
4
+ version: 2.18.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppetlabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-14 00:00:00.000000000 Z
11
+ date: 2015-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -447,6 +447,7 @@ files:
447
447
  - lib/beaker/host/aix/user.rb
448
448
  - lib/beaker/host/freebsd.rb
449
449
  - lib/beaker/host/freebsd/exec.rb
450
+ - lib/beaker/host/freebsd/pkg.rb
450
451
  - lib/beaker/host/mac.rb
451
452
  - lib/beaker/host/mac/exec.rb
452
453
  - lib/beaker/host/mac/group.rb