beaker 2.18.0 → 2.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. checksums.yaml +8 -8
  2. data/HISTORY.md +699 -2
  3. data/acceptance/lib/beaker/acceptance/install_utils.rb +58 -0
  4. data/acceptance/pre_suite/puppet_gem/install.rb +1 -8
  5. data/acceptance/pre_suite/puppet_git/install.rb +6 -65
  6. data/acceptance/pre_suite/puppet_pkg/install.rb +1 -1
  7. data/acceptance/tests/foss_utils/clone_git_repo_on.rb +49 -0
  8. data/beaker.gemspec +2 -0
  9. data/lib/beaker/command.rb +1 -1
  10. data/lib/beaker/dsl/helpers/puppet_helpers.rb +8 -6
  11. data/lib/beaker/dsl/helpers/web_helpers.rb +2 -1
  12. data/lib/beaker/dsl/install_utils/aio_defaults.rb +0 -3
  13. data/lib/beaker/dsl/install_utils/foss_defaults.rb +19 -0
  14. data/lib/beaker/dsl/install_utils/foss_utils.rb +164 -67
  15. data/lib/beaker/dsl/install_utils/pe_defaults.rb +9 -11
  16. data/lib/beaker/dsl/install_utils/pe_utils.rb +48 -64
  17. data/lib/beaker/dsl/install_utils/puppet_utils.rb +43 -0
  18. data/lib/beaker/dsl/install_utils/windows_utils.rb +144 -0
  19. data/lib/beaker/dsl/roles.rb +20 -3
  20. data/lib/beaker/dsl/structure.rb +14 -3
  21. data/lib/beaker/host/freebsd/pkg.rb +18 -0
  22. data/lib/beaker/host/freebsd.rb +2 -0
  23. data/lib/beaker/host/unix/exec.rb +3 -3
  24. data/lib/beaker/host/unix/pkg.rb +37 -0
  25. data/lib/beaker/host/windows/exec.rb +3 -0
  26. data/lib/beaker/host.rb +38 -9
  27. data/lib/beaker/host_prebuilt_steps.rb +21 -11
  28. data/lib/beaker/hypervisor/aws_sdk.rb +22 -18
  29. data/lib/beaker/hypervisor/docker.rb +7 -0
  30. data/lib/beaker/hypervisor/openstack.rb +1 -0
  31. data/lib/beaker/hypervisor/vagrant_virtualbox.rb +10 -5
  32. data/lib/beaker/hypervisor/vmpooler.rb +4 -0
  33. data/lib/beaker/logger.rb +12 -1
  34. data/lib/beaker/options/command_line_parser.rb +9 -0
  35. data/lib/beaker/options/options_hash.rb +3 -296
  36. data/lib/beaker/options/parser.rb +12 -0
  37. data/lib/beaker/options/presets.rb +0 -1
  38. data/lib/beaker/platform.rb +3 -1
  39. data/lib/beaker/ssh_connection.rb +48 -23
  40. data/lib/beaker/test_case.rb +1 -1
  41. data/lib/beaker/version.rb +1 -1
  42. data/spec/beaker/dsl/helpers/puppet_helpers_spec.rb +0 -1
  43. data/spec/beaker/dsl/helpers/web_helpers_spec.rb +10 -1
  44. data/spec/beaker/dsl/install_utils/foss_utils_spec.rb +247 -49
  45. data/spec/beaker/dsl/install_utils/pe_utils_spec.rb +116 -26
  46. data/spec/beaker/dsl/install_utils/puppet_utils_spec.rb +57 -0
  47. data/spec/beaker/dsl/install_utils/windows_utils_spec.rb +132 -0
  48. data/spec/beaker/dsl/roles_spec.rb +36 -5
  49. data/spec/beaker/dsl/structure_spec.rb +9 -2
  50. data/spec/beaker/host/unix/pkg_spec.rb +26 -6
  51. data/spec/beaker/host_prebuilt_steps_spec.rb +3 -2
  52. data/spec/beaker/host_spec.rb +24 -6
  53. data/spec/beaker/hypervisor/aixer_spec.rb +1 -1
  54. data/spec/beaker/hypervisor/aws_sdk_spec.rb +595 -58
  55. data/spec/beaker/hypervisor/docker_spec.rb +2 -1
  56. data/spec/beaker/hypervisor/solaris_spec.rb +1 -0
  57. data/spec/beaker/hypervisor/vagrant_spec.rb +20 -5
  58. data/spec/beaker/hypervisor/vagrant_virtualbox_spec.rb +1 -1
  59. data/spec/beaker/logger_spec.rb +39 -0
  60. data/spec/beaker/options/command_line_parser_spec.rb +2 -2
  61. data/spec/beaker/options/options_hash_spec.rb +1 -102
  62. data/spec/beaker/options/parser_spec.rb +19 -0
  63. data/spec/beaker/options/pe_version_scaper_spec.rb +11 -1
  64. data/spec/beaker/options/presets_spec.rb +8 -0
  65. data/spec/beaker/ssh_connection_spec.rb +39 -21
  66. data/spec/helpers.rb +9 -3
  67. data/spec/mocks.rb +2 -0
  68. metadata +35 -11
  69. data/lib/beaker/answers/version20.rb +0 -120
  70. data/lib/beaker/answers/version28.rb +0 -121
  71. data/lib/beaker/answers/version30.rb +0 -227
  72. data/lib/beaker/answers/version32.rb +0 -44
  73. data/lib/beaker/answers/version34.rb +0 -51
  74. data/lib/beaker/answers/version38.rb +0 -29
  75. data/lib/beaker/answers/version40.rb +0 -44
  76. data/lib/beaker/answers.rb +0 -143
  77. data/spec/beaker/answers_spec.rb +0 -547
@@ -1,4 +1,4 @@
1
- [ 'aio_defaults', 'foss_defaults', 'puppet_utils' ].each do |lib|
1
+ [ 'aio_defaults', 'foss_defaults', 'puppet_utils', 'windows_utils' ].each do |lib|
2
2
  require "beaker/dsl/install_utils/#{lib}"
3
3
  end
4
4
  module Beaker
@@ -18,6 +18,7 @@ module Beaker
18
18
  include AIODefaults
19
19
  include FOSSDefaults
20
20
  include PuppetUtils
21
+ include WindowsUtils
21
22
 
22
23
  # The default install path
23
24
  SourcePath = "/opt/puppet-git-repos"
@@ -28,24 +29,39 @@ module Beaker
28
29
  # Github's ssh signature for cloning via ssh
29
30
  GitHubSig = 'github.com,207.97.227.239 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=='
30
31
 
31
- # Set defaults and PATH for these hosts to be either foss or aio, have host['type'] == aio for aio settings, defaults
32
- # to foss.
32
+ # lookup project-specific git environment variables
33
+ # PROJECT_VAR or VAR otherwise return the default
33
34
  #
34
- # @param [Host, Array<Host>, String, Symbol] hosts One or more hosts to act upon,
35
- # or a role (String or Symbol) that identifies one or more hosts.
36
- def configure_foss_defaults_on( hosts )
37
- block_on hosts do |host|
38
- if (not_controller(host) && host[:version] && (not version_is_less(host[:version], '4.0'))) \
39
- or (host['type'] && host['type'] =~ /aio/)
40
- # add aio defaults to host
41
- add_aio_defaults_on(host)
42
- else
43
- add_foss_defaults_on(host)
44
- end
45
- # add pathing env
46
- add_puppet_paths_on(host)
35
+ # @!visibility private
36
+ def lookup_in_env(env_variable_name, project_name=nil, default=nil)
37
+ env_variable_name = "#{env_variable_name.upcase.gsub('-','_')}"
38
+ project_specific_name = "#{project_name.upcase.gsub('-','_')}_#{env_variable_name}" if project_name
39
+ project_name && ENV[project_specific_name] || ENV[env_variable_name] || default
40
+ end
41
+
42
+ # @param [String] project_name
43
+ # @param [String] git_fork When not provided will use PROJECT_FORK environment variable
44
+ # @param [String] git_server When not provided will use PROJECT_SERVER environment variable
45
+ # @param [String] git_protocol 'git','ssh','https'
46
+ #
47
+ # @return [String] Returns a git-usable url
48
+ #
49
+ # TODO: enable other protocols, clarify, http://git-scm.com/book/ch4-1.html
50
+ def build_git_url(project_name, git_fork = nil, git_server = nil, git_protocol='https')
51
+ git_fork ||= lookup_in_env('FORK', project_name, 'puppetlabs')
52
+ git_server ||= lookup_in_env('SERVER', project_name, 'github.com')
53
+
54
+ case git_protocol
55
+ when /(ssh|git)/
56
+ git_protocol = 'git@'
57
+ when /https/
58
+ git_protocol = 'https://'
47
59
  end
60
+
61
+ repo = (git_server == 'github.com') ? "#{git_fork}/#{project_name}.git" : "#{git_fork}-#{project_name}.git"
62
+ return git_protocol == 'git@' ? "#{git_protocol}#{git_server}:#{repo}" : "#{git_protocol}#{git_server}/#{repo}"
48
63
  end
64
+ alias_method :build_giturl, :build_git_url
49
65
 
50
66
  # @param [String] uri A uri in the format of <git uri>#<revision>
51
67
  # the `git://`, `http://`, `https://`, and ssh
@@ -119,9 +135,18 @@ module Beaker
119
135
  version
120
136
  end
121
137
 
138
+ # @param [Host] host An object implementing {Beaker::Hosts}'s
139
+ # interface.
140
+ # @param [String] path The path on the remote [host] to the repository
141
+ # @param [Hash{Symbol=>String}] repository A hash representing repo
142
+ # info like that emitted by
143
+ # {#extract_repo_info_from}
122
144
  #
123
- # @see #find_git_repo_versions
124
- def install_from_git host, path, repository
145
+ # @note This requires the helper methods:
146
+ # * {Beaker::DSL::Helpers#on}
147
+ #
148
+ def clone_git_repo_on host, path, repository, opts = {}
149
+ opts = {:accept_all_exit_codes => true}.merge(opts)
125
150
  name = repository[:name]
126
151
  repo = repository[:path]
127
152
  rev = repository[:rev]
@@ -140,33 +165,41 @@ module Beaker
140
165
 
141
166
  logger.notify("\n * Clone #{repo} if needed")
142
167
 
143
- on host, "test -d #{path} || mkdir -p #{path}"
144
- on host, "test -d #{target} || #{clone_cmd}"
168
+ on host, "test -d #{path} || mkdir -p #{path}", opts
169
+ on host, "test -d #{target} || #{clone_cmd}", opts
145
170
 
146
171
  logger.notify("\n * Update #{name} and check out revision #{rev}")
147
-
148
172
  commands = ["cd #{target}",
149
173
  "remote rm origin",
150
174
  "remote add origin #{repo}",
151
175
  "fetch origin +refs/pull/*:refs/remotes/origin/pr/* +refs/heads/*:refs/remotes/origin/*",
152
176
  "clean -fdx",
153
177
  "checkout -f #{rev}"]
154
- on host, commands.join(" && git ")
178
+ on host, commands.join(" && git "), opts
179
+ end
155
180
 
181
+ # @see #find_git_repo_versions
182
+ # @note This assumes the target repository application
183
+ # can be installed via an install.rb ruby script.
184
+ def install_from_git_on host, path, repository, opts = {}
185
+ opts = {:accept_all_exit_codes => true}.merge(opts)
186
+ clone_git_repo_on host, path, repository, opts
187
+ name = repository[:name]
156
188
  logger.notify("\n * Install #{name} on the system")
157
189
  # The solaris ruby IPS package has bindir set to /usr/ruby/1.8/bin.
158
190
  # However, this is not the path to which we want to deliver our
159
191
  # binaries. So if we are using solaris, we have to pass the bin and
160
192
  # sbin directories to the install.rb
193
+ target = "#{path}/#{name}"
161
194
  install_opts = ''
162
- install_opts = '--bindir=/usr/bin --sbindir=/usr/sbin' if
163
- host['platform'].include? 'solaris'
195
+ install_opts = '--bindir=/usr/bin --sbindir=/usr/sbin' if host['platform'].include? 'solaris'
164
196
 
165
- on host, "cd #{target} && " +
166
- "if [ -f install.rb ]; then " +
167
- "ruby ./install.rb #{install_opts}; " +
168
- "else true; fi"
197
+ on host, "cd #{target} && " +
198
+ "if [ -f install.rb ]; then " +
199
+ "ruby ./install.rb #{install_opts}; " +
200
+ "else true; fi", opts
169
201
  end
202
+ alias_method :install_from_git, :install_from_git_on
170
203
 
171
204
  # @deprecated Use {#install_puppet_on} instead.
172
205
  def install_puppet(opts = {})
@@ -240,6 +273,10 @@ module Beaker
240
273
  install_puppet_from_msi_on(host, opts)
241
274
  elsif host['platform'] =~ /osx/
242
275
  install_puppet_from_dmg_on(host, opts)
276
+ elsif host['platform'] =~ /openbsd/
277
+ install_puppet_from_openbsd_packages_on(host, opts)
278
+ elsif host['platform'] =~ /freebsd/
279
+ install_puppet_from_freebsd_ports_on(host, opts)
243
280
  else
244
281
  if opts[:default_action] == 'gem_install'
245
282
  opts[:version] ||= '~> 3.x'
@@ -291,12 +328,9 @@ module Beaker
291
328
  opts = FOSS_DEFAULT_DOWNLOAD_URLS.merge(opts)
292
329
  opts[:puppet_collection] ||= 'pc1' #hi! i'm case sensitive! be careful!
293
330
  opts[:puppet_agent_version] ||= opts[:version] #backwards compatability with old parameter name
294
- if not opts[:puppet_agent_version]
295
- raise "must provide :puppet_agent_version (puppet-agent version) for install_puppet_agent_on"
296
- end
297
331
 
298
332
  block_on hosts do |host|
299
- host[:type] = 'aio' #we are installing agent, so we want aio type
333
+ add_role(host, 'aio') #we are installing agent, so we want aio role
300
334
  case host['platform']
301
335
  when /el-4|sles/
302
336
  # pe-only agent, get from dev repo
@@ -418,7 +452,7 @@ module Beaker
418
452
 
419
453
  puppet_pkg = opts[:version] ? "puppet-#{opts[:version]}" : 'puppet'
420
454
  host.install_package("#{puppet_pkg}")
421
- configure_foss_defaults_on( host )
455
+ configure_type_defaults_on( host )
422
456
  end
423
457
  end
424
458
  alias_method :install_puppet_from_rpm, :install_puppet_from_rpm_on
@@ -452,7 +486,7 @@ module Beaker
452
486
  else
453
487
  host.install_package('puppet')
454
488
  end
455
- configure_foss_defaults_on( host )
489
+ configure_type_defaults_on( host )
456
490
  end
457
491
  end
458
492
  alias_method :install_puppet_from_deb, :install_puppet_from_deb_on
@@ -488,7 +522,7 @@ module Beaker
488
522
  install_a_puppet_msi_on(host, opts)
489
523
 
490
524
  end
491
- configure_foss_defaults_on( host )
525
+ configure_type_defaults_on( host )
492
526
  end
493
527
  end
494
528
  alias_method :install_puppet_from_msi, :install_puppet_from_msi_on
@@ -537,7 +571,7 @@ module Beaker
537
571
  def install_puppet_agent_from_msi_on(hosts, opts)
538
572
  block_on hosts do |host|
539
573
 
540
- host[:type] = 'aio' #we are installing agent, so we want aio type
574
+ add_role(host, 'aio') #we are installing agent, so we want aio role
541
575
  is_config_32 = true == (host['ruby_arch'] == 'x86') || host['install_32'] || opts['install_32']
542
576
  should_install_64bit = host.is_x86_64? && !is_config_32
543
577
  arch = should_install_64bit ? 'x64' : 'x86'
@@ -561,32 +595,57 @@ module Beaker
561
595
  raise "Puppet #{version} at #{link} does not exist!"
562
596
  end
563
597
 
598
+
599
+ msi_download_path = "#{get_temp_path(host)}\\#{host['dist']}.msi"
600
+
564
601
  if host.is_cygwin?
565
- dest = "#{host['dist']}.msi"
566
- on host, "curl -O #{link}"
602
+ # NOTE: it is critical that -o be before -O on Windows
603
+ on host, "curl -o \"#{msi_download_path}\" -O #{link}"
567
604
 
568
605
  #Because the msi installer doesn't add Puppet to the environment path
569
606
  #Add both potential paths for simplicity
570
607
  #NOTE - this is unnecessary if the host has been correctly identified as 'foss' during set up
571
608
  puppetbin_path = "\"/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/bin\":\"/cygdrive/c/Program Files/Puppet Labs/Puppet/bin\""
572
609
  on host, %Q{ echo 'export PATH=$PATH:#{puppetbin_path}' > /etc/bash.bashrc }
573
-
574
- on host, "cmd /C 'start /w msiexec.exe /qn /i #{dest}'"
575
610
  else
576
- dest = "C:\\Windows\\Temp\\#{host['dist']}.msi"
577
-
578
- on host, powershell("$webclient = New-Object System.Net.WebClient; $webclient.DownloadFile('#{link}','#{dest}')")
579
-
580
- on host, "start /w msiexec.exe /qn /i #{dest}"
611
+ on host, powershell("$webclient = New-Object System.Net.WebClient; $webclient.DownloadFile('#{link}','#{msi_download_path}')")
581
612
  end
582
613
 
583
- configure_foss_defaults_on( host )
614
+ opts = { :debug => host[:pe_debug] || opts[:pe_debug] }
615
+ install_msi_on(host, msi_download_path, {}, opts)
616
+
617
+ configure_type_defaults_on( host )
584
618
  if not host.is_cygwin?
585
619
  host.mkdir_p host['distmoduledir']
586
620
  end
587
621
  end
588
622
  end
589
623
 
624
+ # Installs Puppet and dependencies from FreeBSD ports
625
+ #
626
+ # @param [Host, Array<Host>, String, Symbol] hosts One or more hosts to act upon,
627
+ # or a role (String or Symbol) that identifies one or more hosts.
628
+ # @param [Hash{Symbol=>String}] opts An options hash
629
+ # @option opts [String] :version The version of Puppet to install (shows warning)
630
+ #
631
+ # @return nil
632
+ # @api private
633
+ def install_puppet_from_freebsd_ports_on( hosts, opts )
634
+ if (opts[:version])
635
+ logger.warn "If you wish to choose a specific Puppet version, use `install_puppet_from_gem_on('~> 3.*')`"
636
+ end
637
+
638
+ block_on hosts do |host|
639
+ if host['platform'] =~ /freebsd-9/
640
+ host.install_package("puppet")
641
+ else
642
+ host.install_package("sysutils/puppet")
643
+ end
644
+ end
645
+
646
+ end
647
+ alias_method :install_puppet_from_freebsd_ports, :install_puppet_from_freebsd_ports_on
648
+
590
649
  # Installs Puppet and dependencies from dmg on provided host(s).
591
650
  #
592
651
  # @param [Host, Array<Host>, String, Symbol] hosts One or more hosts to act upon,
@@ -629,7 +688,7 @@ module Beaker
629
688
  host.install_package("facter-#{facter_ver}")
630
689
  host.install_package("hiera-#{hiera_ver}")
631
690
 
632
- configure_foss_defaults_on( host )
691
+ configure_type_defaults_on( host )
633
692
  end
634
693
  end
635
694
  end
@@ -651,7 +710,7 @@ module Beaker
651
710
  opts[:puppet_collection] = opts[:puppet_collection].upcase #needs to be upcase, more lovely consistency
652
711
  block_on hosts do |host|
653
712
 
654
- host[:type] = 'aio' #we are installing agent, so we want aio type
713
+ add_role(host, 'aio') #we are installing agent, so we want aio role
655
714
 
656
715
  variant, version, arch, codename = host['platform'].to_array
657
716
  agent_version = opts[:puppet_agent_version] || 'latest'
@@ -666,7 +725,27 @@ module Beaker
666
725
 
667
726
  host.install_package(pkg_name)
668
727
 
669
- configure_foss_defaults_on( host )
728
+ configure_type_defaults_on( host )
729
+ end
730
+ end
731
+
732
+ # Installs Puppet and dependencies from OpenBSD packages
733
+ #
734
+ # @param [Host, Array<Host>, String, Symbol] hosts The host to install packages on
735
+ # @param [Hash{Symbol=>String}] opts An options hash
736
+ # @option opts [String] :version The version of Puppet to install (shows warning)
737
+ #
738
+ # @return nil
739
+ # @api private
740
+ def install_puppet_from_openbsd_packages_on(hosts, opts)
741
+ if (opts[:version])
742
+ logger.warn "If you wish to choose a specific Puppet version, use `install_puppet_from_gem_on('~> 3.*')`"
743
+ end
744
+
745
+ block_on hosts do |host|
746
+ host.install_package('puppet')
747
+
748
+ configure_type_defaults_on(host)
670
749
  end
671
750
  end
672
751
 
@@ -705,6 +784,7 @@ module Beaker
705
784
  when /solaris-11/ then 'ruby-18'
706
785
  when /ubuntu-14/ then 'ruby'
707
786
  when /solaris-10|ubuntu|debian|el-|cumulus/ then 'rubygems'
787
+ when /openbsd/ then 'ruby'
708
788
  else
709
789
  raise "install_puppet() called with default_action " +
710
790
  "'gem_install' but program `gem' is " +
@@ -726,16 +806,18 @@ module Beaker
726
806
  on host, "echo '#{path_with_gem}' >> ~/.bashrc"
727
807
  end
728
808
 
809
+ gemflags = '--no-ri --no-rdoc --no-format-executable'
810
+
729
811
  if opts[:facter_version]
730
- on host, "gem install facter -v'#{opts[:facter_version]}' --no-ri --no-rdoc"
812
+ on host, "gem install facter -v'#{opts[:facter_version]}' #{gemflags}"
731
813
  end
732
814
 
733
815
  if opts[:hiera_version]
734
- on host, "gem install hiera -v'#{opts[:hiera_version]}' --no-ri --no-rdoc"
816
+ on host, "gem install hiera -v'#{opts[:hiera_version]}' #{gemflags}"
735
817
  end
736
818
 
737
819
  ver_cmd = opts[:version] ? "-v '#{opts[:version]}'" : ''
738
- on host, "gem install puppet #{ver_cmd} --no-ri --no-rdoc"
820
+ on host, "gem install puppet #{ver_cmd} #{gemflags}"
739
821
 
740
822
  # Similar to the treatment of 'gem' above.
741
823
  # This avoids adding /opt/csw/bin to PATH.
@@ -751,7 +833,13 @@ module Beaker
751
833
  on host, "ln -s #{gem_exec_dir}/facter /usr/bin/facter"
752
834
  on host, "ln -s #{gem_exec_dir}/puppet /usr/bin/puppet"
753
835
  end
754
- configure_foss_defaults_on( host )
836
+
837
+ # A gem install might not necessarily create these
838
+ ['confdir', 'logdir', 'codedir'].each do |key|
839
+ host.mkdir_p host.puppet[key] if host.puppet.has_key?(key)
840
+ end
841
+
842
+ configure_type_defaults_on( host )
755
843
  end
756
844
  end
757
845
  alias_method :install_puppet_from_gem, :install_puppet_from_gem_on
@@ -790,7 +878,7 @@ module Beaker
790
878
  else
791
879
  raise "No repository installation step for #{variant} yet..."
792
880
  end
793
- configure_foss_defaults_on( host )
881
+ configure_type_defaults_on( host )
794
882
  end
795
883
  end
796
884
  alias_method :install_puppetlabs_release_repo, :install_puppetlabs_release_repo_on
@@ -931,7 +1019,7 @@ module Beaker
931
1019
 
932
1020
  on host, find_and_sed
933
1021
  on host, "apt-get update"
934
- configure_foss_defaults_on( host )
1022
+ configure_type_defaults_on( host )
935
1023
 
936
1024
  else
937
1025
  raise "No repository installation step for #{variant} yet..."
@@ -960,7 +1048,7 @@ module Beaker
960
1048
  end
961
1049
  find_command = "find /root/#{package_name} -type f -name '#{find_filename}' -exec #{find_command} {} \\;"
962
1050
  on host, find_command
963
- configure_foss_defaults_on( host )
1051
+ configure_type_defaults_on( host )
964
1052
  end
965
1053
 
966
1054
  # Install development repo of the puppet-agent on the given host(s). Downloaded from
@@ -1007,7 +1095,7 @@ module Beaker
1007
1095
  opts[:copy_base_local] ||= File.join('tmp', 'repo_configs')
1008
1096
  opts[:copy_dir_external] ||= File.join('/', 'root')
1009
1097
  opts[:puppet_collection] ||= 'PC1'
1010
- host[:type] = 'aio' #we are installing agent, so we want aio type
1098
+ add_role(host, 'aio') #we are installing agent, so we want aio role
1011
1099
  release_path = opts[:download_url]
1012
1100
  variant, version, arch, codename = host['platform'].to_array
1013
1101
  copy_dir_local = File.join(opts[:copy_base_local], variant)
@@ -1056,11 +1144,12 @@ module Beaker
1056
1144
  when /^windows$/
1057
1145
  result = on host, "echo #{onhost_copied_file}"
1058
1146
  onhost_copied_file = result.raw_output.chomp
1059
- on host, Command.new("start /w #{onhost_copied_file}", [], { :cmdexe => true })
1147
+ opts = { :debug => host[:pe_debug] || opts[:pe_debug] }
1148
+ install_msi_on(host, onhost_copied_file, {}, opts)
1060
1149
  when /^osx$/
1061
1150
  host.install_package("#{mac_pkg_name}*")
1062
1151
  end
1063
- configure_foss_defaults_on( host )
1152
+ configure_type_defaults_on( host )
1064
1153
  end
1065
1154
  end
1066
1155
  alias_method :install_puppetagent_dev_repo, :install_puppet_agent_dev_repo_on
@@ -1092,14 +1181,14 @@ module Beaker
1092
1181
  def install_puppet_agent_pe_promoted_repo_on( hosts, opts )
1093
1182
  opts[:puppet_agent_version] ||= 'latest'
1094
1183
  block_on hosts do |host|
1095
- pe_ver = host[:pe_ver] || opts[:pe_ver] || '4.0'
1184
+ pe_ver = host[:pe_ver] || opts[:pe_ver] || '4.0.0-rc1'
1096
1185
  variant, version, arch, codename = host['platform'].to_array
1097
1186
  opts = FOSS_DEFAULT_DOWNLOAD_URLS.merge(opts)
1098
- opts[:download_url] = "#{opts[:pe_promoted_builds_url]}/puppet-agent/#{ pe_ver }/#{ opts[:puppet_agent_version] }/repos/"
1187
+ opts[:download_url] = "#{opts[:pe_promoted_builds_url]}/puppet-agent/#{ pe_ver }/#{ opts[:puppet_agent_version] }/repos"
1099
1188
  opts[:copy_base_local] ||= File.join('tmp', 'repo_configs')
1100
1189
  opts[:copy_dir_external] ||= File.join('/', 'root')
1101
1190
  opts[:puppet_collection] ||= 'PC1'
1102
- host[:type] = 'aio' #we are installing agent, so we want aio type
1191
+ add_role(host, 'aio') #we are installing agent, so we want aio role
1103
1192
  release_path = opts[:download_url]
1104
1193
  variant, version, arch, codename = host['platform'].to_array
1105
1194
  copy_dir_local = File.join(opts[:copy_base_local], variant)
@@ -1114,6 +1203,7 @@ module Beaker
1114
1203
  if arch == 'x86_64'
1115
1204
  arch = 'amd64'
1116
1205
  end
1206
+ version = version[0,2] + '.' + version[2,2] if variant =~ /ubuntu/ && version =~ /\.{0}/
1117
1207
  release_file = "/repos/apt/#{codename}/pool/#{opts[:puppet_collection]}/p/puppet-agent/puppet-agent*#{arch}.deb"
1118
1208
  download_file = "puppet-agent-#{variant}-#{version}-#{arch}.tar.gz"
1119
1209
  when /^windows$/
@@ -1124,7 +1214,7 @@ module Beaker
1124
1214
  # - we do not have install_32 set on host
1125
1215
  # - we do not have install_32 set globally
1126
1216
  arch_suffix = should_install_64bit ? '64' : '86'
1127
- release_path += "windows/"
1217
+ release_path += "/windows"
1128
1218
  release_file = "/puppet-agent-x#{arch_suffix}.msi"
1129
1219
  download_file = "puppet-agent-x#{arch_suffix}.msi"
1130
1220
  when /^osx$/
@@ -1141,9 +1231,15 @@ module Beaker
1141
1231
  scp_to host, File.join(copy_dir_local, download_file), onhost_copy_base
1142
1232
 
1143
1233
  case variant
1144
- when /^(fedora|el|centos|sles)$/
1234
+ when /^(fedora-22)$/
1235
+ on host, "tar -zxvf #{onhost_copied_download} -C #{onhost_copy_base}"
1236
+ on host, "dnf --nogpgcheck localinstall -y #{onhost_copied_file}"
1237
+ when /^(fedora|el|centos)$/
1145
1238
  on host, "tar -zxvf #{onhost_copied_download} -C #{onhost_copy_base}"
1146
1239
  on host, "yum --nogpgcheck localinstall -y #{onhost_copied_file}"
1240
+ when /^(sles)$/
1241
+ on host, "tar -zxvf #{onhost_copied_download} -C #{onhost_copy_base}"
1242
+ on host, "rpm -ihv #{onhost_copied_file}"
1147
1243
  when /^(debian|ubuntu|cumulus)$/
1148
1244
  on host, "tar -zxvf #{onhost_copied_download} -C #{onhost_copy_base}"
1149
1245
  on host, "dpkg -i --force-all #{onhost_copied_file}"
@@ -1151,19 +1247,20 @@ module Beaker
1151
1247
  when /^windows$/
1152
1248
  result = on host, "echo #{onhost_copied_file}"
1153
1249
  onhost_copied_file = result.raw_output.chomp
1154
- on host, Command.new("start /w #{onhost_copied_file}", [], { :cmdexe => true })
1250
+ opts = { :debug => host[:pe_debug] || opts[:pe_debug] }
1251
+ install_msi_on(host, onhost_copied_file, {}, opts)
1155
1252
  when /^osx$/
1156
1253
  on host, "tar -zxvf #{onhost_copied_download} -C #{onhost_copy_base}"
1157
1254
  # move to better location
1158
1255
  on host, "mv #{onhost_copied_file}.dmg ."
1159
1256
  host.install_package("puppet-agent-*")
1160
1257
  end
1161
- configure_foss_defaults_on( host )
1258
+ configure_type_defaults_on( host )
1162
1259
  end
1163
1260
  end
1164
1261
 
1165
1262
 
1166
- # This method will install a pem file certifcate on a windows host
1263
+ # This method will install a pem file certificate on a windows host
1167
1264
  #
1168
1265
  # @param [Host] host A host object
1169
1266
  # @param [String] cert_name The name of the pem file
@@ -11,7 +11,7 @@ module Beaker
11
11
  PE_DEFAULTS = {
12
12
  'mac' => {
13
13
  'puppetserver-confdir' => '/etc/puppetlabs/puppetserver/conf.d',
14
- 'puppetservice' => 'pe-httpd',
14
+ 'puppetservice' => 'pe-puppetserver',
15
15
  'puppetpath' => '/etc/puppetlabs/puppet',
16
16
  'puppetconfdir' => '/etc/puppetlabs/puppet',
17
17
  'puppetcodedir' => '/etc/puppetlabs/puppet',
@@ -26,7 +26,7 @@ module Beaker
26
26
  },
27
27
  'unix' => {
28
28
  'puppetserver-confdir' => '/etc/puppetlabs/puppetserver/conf.d',
29
- 'puppetservice' => 'pe-httpd',
29
+ 'puppetservice' => 'pe-puppetserver',
30
30
  'puppetpath' => '/etc/puppetlabs/puppet',
31
31
  'puppetconfdir' => '/etc/puppetlabs/puppet',
32
32
  'puppetbin' => '/opt/puppet/bin/puppet',
@@ -40,7 +40,7 @@ module Beaker
40
40
  'sitemoduledir' => '/opt/puppet/share/puppet/modules',
41
41
  },
42
42
  'windows' => { #cygwin windows
43
- 'puppetservice' => 'pe-httpd',
43
+ 'puppetservice' => 'pe-puppetserver',
44
44
  'puppetpath' => '`cygpath -smF 35`/PuppetLabs/puppet/etc',
45
45
  'puppetconfdir' => '`cygpath -smF 35`/PuppetLabs/puppet/etc',
46
46
  'puppetcodedir' => '`cygpath -smF 35`/PuppetLabs/puppet/etc',
@@ -53,7 +53,7 @@ module Beaker
53
53
  'privatebindir' => '/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet Enterprise/sys/ruby/bin:/cygdrive/c/Program Files/Puppet Labs/Puppet Enterprise/sys/ruby/bin',
54
54
  },
55
55
  'pswindows' => { #windows windows
56
- 'puppetservice' => 'pe-httpd',
56
+ 'puppetservice' => 'pe-puppetserver',
57
57
  'puppetpath' => 'C:\\ProgramData\\PuppetLabs\\puppet\\etc',
58
58
  'puppetconfdir' => 'C:\\ProgramData\\PuppetLabs\\puppet\\etc',
59
59
  'puppetcodedir' => 'C:\\ProgramData\\PuppetLabs\\puppet\\etc',
@@ -79,10 +79,10 @@ module Beaker
79
79
  host['group'] = 'pe-puppet'
80
80
  end
81
81
  host['type'] = 'pe'
82
- # newer pe requires a different puppetservice name, set it here on the master
82
+ # older pe requires a different puppetservice name, set it here on the master
83
83
  if host['roles'].include?('master')
84
- if host['pe_ver'] and (not version_is_less(host['pe_ver'], '3.4'))
85
- host['puppetservice'] = 'pe-puppetserver'
84
+ if host['pe_ver'] and (version_is_less(host['pe_ver'], '3.4'))
85
+ host['puppetservice'] = 'pe-httpd'
86
86
  end
87
87
  end
88
88
  end
@@ -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/