beaker-puppet 1.7.0 → 1.8.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 91f9dff9d57b28cd3bd634842fdb9cadb179139c
4
- data.tar.gz: 94a363edc67c9d806dcd97f99d331bb3ad7a21d8
3
+ metadata.gz: de946f1d393facad35ab19ca4864743772344082
4
+ data.tar.gz: 01993f13f7f622a4ab94928b681640a07ce9706b
5
5
  SHA512:
6
- metadata.gz: ea5fa35c971236f41bdc364f2d6c9f1d73f8009fda38a30da915ff5d36d4033e77f716dbd5ac3b31b59d155bbf0eaa29dbb88984fcdd51b75dfd3b2b443f28f0
7
- data.tar.gz: 9b6ddd716275eb8ce105ebc3b36c035e2d835c24ab8a342db70a8740b532fa3e5286e86b631c2cd7cdf92d2f3b003168910c509ab23902fe4f29a247ad69e529
6
+ metadata.gz: e1b58fa827fa766d54f3d900c2a7a8b2ffe9dd8ddb3ae54d8a19c23ab88f6b0a6674d45d3b23d46569c8ffec0135ba1bc7714196f4ba24ac2a3cb7ab402cb90f
7
+ data.tar.gz: 4d21d18da09e34b826d7a9218a7dce6eef26aeec1745e4289940e7a655332e6bc6563e31d16e7bece336700aedc83238c741ba6947ec560de3a99faa09b74165
@@ -23,8 +23,13 @@ module Beaker
23
23
  # include sys/ruby) and the newer versions, which have no custom ruby
24
24
  # directory
25
25
  'windows' => { # windows with cygwin
26
- 'puppetbindir' => '/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/bin:/cygdrive/c/Program Files/Puppet Labs/Puppet/bin',
27
- 'privatebindir' => '/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/puppet/bin:/cygdrive/c/Program Files/Puppet Labs/Puppet/puppet/bin:/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/sys/ruby/bin:/cygdrive/c/Program Files/Puppet Labs/Puppet/sys/ruby/bin',
26
+ 'puppetbindir' => '/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/bin',
27
+ 'privatebindir' => '/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/puppet/bin:/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/sys/ruby/bin',
28
+ 'distmoduledir' => '`cygpath -smF 35`/PuppetLabs/code/modules',
29
+ },
30
+ 'windows-64' => { # windows with cygwin
31
+ 'puppetbindir' => '/cygdrive/c/Program Files/Puppet Labs/Puppet/bin',
32
+ 'privatebindir' => '/cygdrive/c/Program Files/Puppet Labs/Puppet/puppet/bin:/cygdrive/c/Program Files/Puppet Labs/Puppet/sys/ruby/bin',
28
33
  'distmoduledir' => '`cygpath -smF 35`/PuppetLabs/code/modules',
29
34
  },
30
35
  'pswindows' => { # pure windows
@@ -57,7 +62,16 @@ module Beaker
57
62
  if host.is_powershell?
58
63
  platform = 'pswindows'
59
64
  elsif host['platform'] =~ /windows/
60
- platform = 'windows'
65
+ if host[:ruby_arch] == 'x64'
66
+ ruby_arch = /-64/
67
+ else
68
+ ruby_arch = /-32/
69
+ end
70
+ if host['platform'] =~ ruby_arch
71
+ platform = 'windows-64'
72
+ else
73
+ platform = 'windows'
74
+ end
61
75
  else
62
76
  platform = 'unix'
63
77
  end
@@ -1447,18 +1447,26 @@ module Beaker
1447
1447
  "env PATH=\"#{host['privatebindir']}:${PATH}\" ruby"
1448
1448
  end
1449
1449
 
1450
- def gem_command(host, type = 'aio')
1451
- if type == 'aio'
1450
+ def get_command(command_name, host, type = 'aio')
1451
+ if ['aio', 'git'].include?(type)
1452
1452
  if host['platform'] =~ /windows/
1453
- "env PATH=\"#{host['privatebindir']}:${PATH}\" cmd /c gem"
1453
+ "env PATH=\"#{host['privatebindir']}:${PATH}\" cmd /c #{command_name}"
1454
1454
  else
1455
- "env PATH=\"#{host['privatebindir']}:${PATH}\" gem"
1455
+ "env PATH=\"#{host['privatebindir']}:${PATH}\" #{command_name}"
1456
1456
  end
1457
1457
  else
1458
- on(host, 'which gem').stdout.chomp
1458
+ on(host, "which #{command_name}").stdout.chomp
1459
1459
  end
1460
1460
  end
1461
1461
 
1462
+ def bundle_command(host, type = 'aio')
1463
+ get_command('bundle', host, type)
1464
+ end
1465
+
1466
+ def gem_command(host, type = 'aio')
1467
+ get_command('gem', host, type)
1468
+ end
1469
+
1462
1470
  # Configures gem sources on hosts to use a mirror, if specified
1463
1471
  # This is a duplicate of the Gemfile logic.
1464
1472
  def configure_gem_mirror(hosts)
@@ -21,7 +21,7 @@ module Beaker
21
21
  # 'foss'
22
22
  def normalize_type type
23
23
  case type
24
- when /(\A|-)(git)|(foss)(\Z|-)/
24
+ when /(\A|-)foss(\Z|-)/
25
25
  'foss'
26
26
  when /(\A|-)pe(\Z|-)/
27
27
  'pe'
@@ -35,7 +35,7 @@ module Beaker
35
35
  #Given a host construct a PATH that includes puppetbindir, facterbindir and hierabindir
36
36
  # @param [Host] host A single host to construct pathing for
37
37
  def construct_puppet_path(host)
38
- path = (%w(puppetbindir facterbindir hierabindir)).compact.reject(&:empty?)
38
+ path = (%w(puppetbindir facterbindir hierabindir privatebindir)).compact.reject(&:empty?)
39
39
  #get the PATH defaults
40
40
  path.map! { |val| host[val] }
41
41
  path = path.compact.reject(&:empty?)
@@ -1,3 +1,3 @@
1
1
  module BeakerPuppet
2
- VERSION = '1.7.0'
2
+ VERSION = '1.8.0'
3
3
  end
File without changes
File without changes
File without changes
File without changes
@@ -1,68 +1,44 @@
1
1
  test_name "Setup environment"
2
2
 
3
- step "Ensure Git and Ruby"
3
+ require 'json'
4
+ require 'open-uri'
4
5
 
6
+ step 'Configure paths' do
7
+ add_aio_defaults_on(hosts)
8
+ add_puppet_paths_on(hosts)
9
+ end
10
+
11
+ step "Install git and tar"
5
12
  PACKAGES = {
6
- :redhat => [
7
- 'git',
8
- 'ruby',
9
- 'rubygem-json', # invalid on RHEL6
10
- 'rubygem-io-console', # required for Fedora25 to bundle install
11
- 'rubygem-rdoc' # required for Fedora25 to install gems
12
- ],
13
+ :redhat => ['git'],
13
14
  :debian => [
14
15
  ['git', 'git-core'],
15
- 'ruby',
16
- ],
17
- :debian_ruby18 => [
18
- 'libjson-ruby',
19
- ],
20
- :solaris_11 => [
21
- ['git', 'developer/versioning/git'],
22
16
  ],
23
17
  :solaris_10 => [
24
18
  'coreutils',
25
- 'curl', # update curl to fix "CURLOPT_SSL_VERIFYHOST no longer supports 1 as value!" issue
26
19
  'git',
27
- 'ruby19',
28
- 'ruby19_dev',
29
- 'gcc4core',
30
- ],
31
- :windows => [
32
- 'git',
33
- # there isn't a need for json on windows because it is bundled in ruby 1.9
20
+ 'gtar',
34
21
  ],
22
+ :windows => ['git'],
23
+ :sles => ['git'],
35
24
  }
36
25
 
37
- # override incorrect FOSS (git) defaults from Beaker with AIO applicable ones
38
- #
39
- # Remove after PUP-4867 breaks distmoduledir and sitemoduledir into individual
40
- # settings from modulepath and Beaker can properly introspect these settings
41
- hosts.each do |host|
42
- platform = host['platform'] =~ /windows/ ? 'windows' : 'unix'
43
-
44
- host['puppetbindir'] = '/usr/bin' if platform == 'windows'
26
+ # We need to be able override which tar we use on solaris, which we call later
27
+ # when we unpack the puppet-runtime archive
28
+ tar = 'tar'
45
29
 
46
- # Beakers add_aio_defaults_on helper is not appropriate here as it
47
- # also alters puppetbindir / privatebindir to use package installed
48
- # paths rather than git installed paths
49
- host['distmoduledir'] = AIO_DEFAULTS[platform]['distmoduledir']
50
- host['sitemoduledir'] = AIO_DEFAULTS[platform]['sitemoduledir']
51
- end
52
-
53
- hosts.each do |host|
30
+ agents.each do |host|
54
31
  case host['platform']
55
- when /solaris-10/
56
- on host, 'mkdir -p /var/lib'
57
- on host, 'ln -sf /opt/csw/bin/pkgutil /usr/bin/pkgutil'
58
- on host, 'ln -sf /opt/csw/bin/gem19 /usr/bin/gem'
59
- on host, 'ln -sf /opt/csw/bin/git /usr/bin/git'
60
- on host, 'ln -sf /opt/csw/bin/ruby19 /usr/bin/ruby'
61
- on host, 'ln -sf /opt/csw/bin/gstat /usr/bin/stat'
62
- on host, 'ln -sf /opt/csw/bin/greadlink /usr/bin/readlink'
63
- when /solaris-11/
64
- step "#{host} jump through hoops to install ruby19; switch back to runtime/ruby-19 after template upgrade to sol11.2"
65
- create_remote_file host, "/root/shutupsolaris", <<END
32
+ when /solaris/
33
+ tar = 'gtar'
34
+ if host['platform'] =~ /11/
35
+ # The file allows us to non-interactively install these packages with
36
+ # pkgutil on solaris 11. Solaris 10 does this as a part of the
37
+ # `install_packages_on` method in beaker. Since we install packages for
38
+ # solaris 11 using pkg by default, we can't use that method for sol11.
39
+ # We have to override it so that we can get git from opencws, as it has
40
+ # the updated ssl certs we need to access github repos.
41
+ create_remote_file host, "/root/shutupsolaris", <<-END
66
42
  mail=
67
43
  # Overwrite already installed instances
68
44
  instance=overwrite
@@ -83,60 +59,81 @@ conflict=nocheck
83
59
  action=nocheck
84
60
  # Install to the default base directory.
85
61
  basedir=default
86
- END
87
- on host, 'pkgadd -a /root/shutupsolaris -d http://get.opencsw.org/now all'
88
- on host, '/opt/csw/bin/pkgutil -U all'
89
- on host, '/opt/csw/bin/pkgutil -i -y ruby19_dev'
90
- on host, '/opt/csw/bin/pkgutil -i -y ruby19'
91
- on host, 'ln -sf /opt/csw/bin/gem19 /usr/bin/gem'
92
- on host, 'ln -sf /opt/csw/bin/ruby19 /usr/bin/ruby'
62
+ END
63
+ on host, 'pkgadd -d http://get.opencsw.org/now -a /root/shutupsolaris -n all'
64
+ on host, '/opt/csw/bin/pkgutil -U all'
65
+ on host, '/opt/csw/bin/pkgutil -y -i git'
66
+ on host, '/opt/csw/bin/pkgutil -y -i gtar'
67
+ end
68
+ host.add_env_var('PATH', '/opt/csw/bin')
93
69
  end
94
70
  end
95
71
 
96
- install_packages_on(hosts, PACKAGES, :check_if_exists => true)
72
+ install_packages_on(agents, PACKAGES, :check_if_exists => true)
97
73
 
98
- hosts.each do |host|
99
- case host['platform']
100
- when /windows/
101
- arch = host[:ruby_arch] || 'x86'
102
- step "#{host} Selected architecture #{arch}"
103
-
104
- revision = if arch == 'x64'
105
- '2.1.x-x64'
106
- else
107
- '2.1.x-x86'
108
- end
109
-
110
- step "#{host} Install ruby from git using revision #{revision}"
111
- # TODO remove this step once we are installing puppet from msi packages
112
- win_path = on(host, 'cygpath -m /opt/puppet-git-repos').stdout.chomp
113
- install_from_git_on(host, win_path,
114
- :name => 'puppet-win32-ruby',
115
- :path => build_git_url('puppet-win32-ruby'),
116
- :rev => revision)
117
- on host, 'cd /opt/puppet-git-repos/puppet-win32-ruby; cp -r ruby/* /'
118
- on host, 'cd /lib; icacls ruby /grant "Everyone:(OI)(CI)(RX)"'
119
- on host, 'cd /lib; icacls ruby /reset /T'
120
- on host, 'cd /; icacls bin /grant "Everyone:(OI)(CI)(RX)"'
121
- on host, 'cd /; icacls bin /reset /T'
122
- on host, 'ruby --version'
123
- on host, 'cmd /c gem list'
74
+ step "Unpack puppet-runtime" do
75
+ dev_builds_url = ENV['DEV_BUILDS_URL'] || 'http://builds.delivery.puppetlabs.net'
76
+ branch = ENV['RUNTIME_BRANCH'] || 'master'
77
+
78
+ # We want to grab whatever tag has been promoted most recently into the branch
79
+ # of puppet-agent that corresponds to whatever component we're working on.
80
+ # This will allow us to get the latest runtime package that has passed tests.
81
+ runtime_json = "https://raw.githubusercontent.com/puppetlabs/puppet-agent/#{branch}/configs/components/puppet-runtime.json"
82
+ runtime_tag = JSON.load(open(runtime_json))['version']
83
+
84
+ runtime_url = "#{dev_builds_url}/puppet-runtime/#{runtime_tag}/artifacts/"
85
+
86
+ runtime_prefix = "agent-runtime-#{branch}-#{runtime_tag}."
87
+ runtime_suffix = ".tar.gz"
88
+
89
+ agents.each do |host|
90
+ platform_tag = host['packaging_platform']
91
+ if platform_tag =~ /windows/
92
+ # the windows version is hard coded to `2012r2`. Unfortunately,
93
+ # `host['packaging_platform']` is hard coded to `2012`, so we have to add
94
+ # the `r2` on our own.
95
+ platform, version, arch = platform_tag.split('-')
96
+ platform_tag = "#{platform}-#{version}r2-#{arch}"
97
+ end
98
+ tarball_name = runtime_prefix + platform_tag + runtime_suffix
99
+
100
+ on host, "curl -Of #{runtime_url}#{tarball_name}"
101
+
102
+ case host['platform']
103
+ when /windows/
104
+ on host, "gunzip -c #{tarball_name} | tar -k -C /cygdrive/c/ -xf -"
105
+
106
+ if arch == 'x64'
107
+ program_files = 'ProgramFiles64Folder'
108
+ else
109
+ program_files = 'ProgramFilesFolder'
110
+ end
111
+ if branch == '5.5.x'
112
+ bindir = "/cygdrive/c/#{program_files}/PuppetLabs/Puppet/sys/ruby/bin"
113
+ else
114
+ bindir = "/cygdrive/c/#{program_files}/PuppetLabs/Puppet/puppet/bin"
115
+ end
116
+ on host, "chmod 755 #{bindir}/*"
117
+
118
+ # Because the runtime archive for windows gets installed in a non-standard
119
+ # directory (ProgramFiles64Folder), we need to add it to the path here
120
+ # rather than rely on `host['privatebindir']` like we can for other
121
+ # platforms
122
+ host.add_env_var('PATH', bindir)
123
+ when /osx/
124
+ on host, "tar -xzf #{tarball_name}"
125
+ on host, "for d in opt var private; do rsync -ka \"${d}/\" \"/${d}/\"; done"
126
+ else
127
+ on host, "gunzip -c #{tarball_name} | #{tar} -k -C / -xf -"
128
+ end
124
129
  end
125
130
  end
126
131
 
127
- # Only configure gem mirror after Ruby has been installed, but before any gems are installed.
128
- configure_gem_mirror(hosts)
132
+ step "Install bundler" do
133
+ # Only configure gem mirror after Ruby has been installed, but before any gems are installed.
134
+ configure_gem_mirror(agents)
129
135
 
130
- hosts.each do |host|
131
- case host['platform']
132
- when /solaris/
133
- step "#{host} Install json from rubygems"
134
- on host, 'gem install json_pure --no-ri --no-rdoc --version 1.8.3' # json_pure 2.0 requires ruby 2
135
- on host, 'gem install bundler --no-ri --no-rdoc'
136
- on host, "ln -sf /opt/csw/bin/bundle #{host['puppetbindir']}/bundle"
137
- when /windows/
138
- on host, 'cmd /c gem install bundler --no-ri --no-rdoc'
139
- else
140
- on host, 'gem install bundler --no-ri --no-rdoc'
136
+ agents.each do |host|
137
+ on host, "#{gem_command(host)} install bundler --no-ri --no-rdoc"
141
138
  end
142
139
  end
@@ -1,79 +1,60 @@
1
- test_name "Install packages and repositories on target machines..." do
1
+ test_name "Install repositories on target machines..." do
2
+
2
3
  repositories = options[:install].map do |url|
3
4
  extract_repo_info_from(build_git_url(url))
4
5
  end
5
6
 
6
- hosts.each_with_index do |host, index|
7
+ agents.each_with_index do |host, index|
7
8
  on host, "echo #{GitHubSig} >> $HOME/.ssh/known_hosts"
8
9
 
9
10
  repositories.each do |repository|
10
11
  step "Install #{repository[:name]}"
11
- if repository[:path] =~ /^file:\/\/(.+)$/
12
- on host, "test -d #{SourcePath} || mkdir -p #{SourcePath}"
13
- source_dir = $1
14
- checkout_dir = "#{SourcePath}/#{repository[:name]}"
15
- on host, "rm -f #{checkout_dir}" # just the symlink, do not rm -rf !
16
- on host, "ln -s #{source_dir} #{checkout_dir}"
17
- on host, "cd #{checkout_dir} && if [ -f install.rb ]; then ruby ./install.rb ; else true; fi"
18
- else
19
- puppet_dir = host.tmpdir('puppet')
20
- on(host, "chmod 755 #{puppet_dir}")
12
+ repo_dir = host.tmpdir(repository[:name])
13
+ on(host, "chmod 755 #{repo_dir}")
14
+
15
+ gem_source = ENV["GEM_SOURCE"] || "https://rubygems.org"
21
16
 
17
+ case repository[:path]
18
+ when /^(git:|https:|git@)/
22
19
  sha = ENV['SHA'] || `git rev-parse HEAD`.chomp
23
- gem_source = ENV["GEM_SOURCE"] || "https://rubygems.org"
24
- gemfile_contents = <<END
20
+ gem_path = ":git => '#{repository[:path]}', :ref => '#{sha}'"
21
+ when /^file:\/\/(.*)/
22
+ gem_path = ":path => '#{$1}'"
23
+ else
24
+ gem_path = repository[:path]
25
+ end
26
+ create_remote_file(host, "#{repo_dir}/Gemfile", <<-END)
25
27
  source '#{gem_source}'
26
- gem '#{repository[:name]}', :git => '#{repository[:path]}', :ref => '#{sha}'
27
- END
28
- case host['platform']
29
- when /windows/
30
- create_remote_file(host, "#{puppet_dir}/Gemfile", gemfile_contents)
31
- # bundle must be passed a Windows style path for a binstubs location
32
- bindir = host['puppetbindir'].split(':').first
33
- binstubs_dir = on(host, "cygpath -m \"#{bindir}\"").stdout.chomp
34
- # note passing --shebang to bundle is not useful because Cygwin
35
- # already finds the Ruby interpreter OK with the standard shebang of:
36
- # !/usr/bin/env ruby
37
- # the problem is a Cygwin style path is passed to the interpreter and this can't be modified:
38
- # http://cygwin.1069669.n5.nabble.com/Pass-windows-style-paths-to-the-interpreter-from-the-shebang-line-td43870.html
39
- on host, "cd #{puppet_dir} && cmd.exe /c \"bundle install --system --binstubs '#{binstubs_dir}'\""
40
- # puppet.bat isn't written by Bundler, but facter.bat is - copy this generic file
41
- on host, "cd #{host['puppetbindir']} && test -f ./puppet.bat || cp ./facter.bat ./puppet.bat"
42
- # to access gem / facter / puppet / bundle / irb with Cygwin generally requires aliases
43
- # so that commands in /usr/bin are overridden and the binstub wrappers won't run inside Cygwin
44
- # but rather will execute as batch files through cmd.exe
45
- # without being overridden, Cygwin reads the shebang and causes errors like:
46
- # C:\cygwin64\bin\ruby.exe: No such file or directory -- /usr/bin/puppet (LoadError)
47
- # NOTE /usr/bin/puppet is a Cygwin style path that our custom Ruby build
48
- # does not understand - it expects a standard Windows path like c:\cygwin64\bin\puppet
28
+ gem '#{repository[:name]}', #{gem_path}
29
+ END
49
30
 
50
- # a workaround in interactive SSH is to add aliases to local session / .bashrc:
51
- # on host, "echo \"alias puppet='C:/\\cygwin64/\\bin/\\puppet.bat'\" >> ~/.bashrc"
52
- # note that this WILL NOT impact Beaker runs though
53
- puppet_bundler_install_dir = on(host, "cd #{puppet_dir} && cmd.exe /c bundle show puppet").stdout.chomp
54
- when /el-7/
55
- create_remote_file(host, "#{puppet_dir}/Gemfile", gemfile_contents + "gem 'json'\n")
56
- on host, "cd #{puppet_dir} && bundle install --system --binstubs #{host['puppetbindir']}"
57
- puppet_bundler_install_dir = on(host, "cd #{puppet_dir} && bundle show puppet").stdout.chomp
58
- when /solaris/
59
- create_remote_file(host, "#{puppet_dir}/Gemfile", gemfile_contents)
60
- on host, "cd #{puppet_dir} && bundle install --system --binstubs #{host['puppetbindir']} --shebang #{host['puppetbindir']}/ruby"
61
- puppet_bundler_install_dir = on(host, "cd #{puppet_dir} && bundle show puppet").stdout.chomp
62
- else
63
- create_remote_file(host, "#{puppet_dir}/Gemfile", gemfile_contents)
64
- on host, "cd #{puppet_dir} && bundle install --system --binstubs #{host['puppetbindir']}"
65
- puppet_bundler_install_dir = on(host, "cd #{puppet_dir} && bundle show puppet").stdout.chomp
66
- end
31
+ case host['platform']
32
+ when /windows/
33
+ # bundle must be passed a Windows style path for a binstubs location
34
+ bindir = host['puppetbindir'].split(':').first
35
+ binstubs_dir = on(host, "cygpath -m \"#{bindir}\"").stdout.chomp
36
+ # note passing --shebang to bundle is not useful because Cygwin
37
+ # already finds the Ruby interpreter OK with the standard shebang of:
38
+ # !/usr/bin/env ruby
39
+ # the problem is a Cygwin style path is passed to the interpreter and this can't be modified:
40
+ # http://cygwin.1069669.n5.nabble.com/Pass-windows-style-paths-to-the-interpreter-from-the-shebang-line-td43870.html
41
+ on host, "cd #{repo_dir} && #{bundle_command(host)} install --system --binstubs '#{binstubs_dir}'"
67
42
 
68
- # install.rb should also be called from the Puppet gem install dir
69
- # this is required for the puppetres.dll event log dll on Windows
70
- on host, "cd #{puppet_bundler_install_dir} && if [ -f install.rb ]; then ruby ./install.rb ; else true; fi"
43
+ # bundler created but does not install batch files to the binstubs dir
44
+ # so we have to manually copy the batch files over
45
+ gemdir = on(host, "#{gem_command(host)} environment gemdir").stdout.chomp
46
+ gembindir = File.join(gemdir, 'bin')
47
+ on host, "cd '#{host['puppetbindir']}' && test -f ./#{repository[:name]}.bat || cp '#{gembindir}/#{repository[:name]}.bat' '#{host['puppetbindir']}/#{repository[:name]}.bat'"
48
+ else
49
+ on host, "cd #{repo_dir} && #{bundle_command(host)} install --system --binstubs #{host['puppetbindir']}"
71
50
  end
51
+ puppet_bundler_install_dir ||= on(host, "cd #{repo_dir} && #{bundle_command(host)} show #{repository[:name]}").stdout.chomp
52
+ host.add_env_var('RUBYLIB', File.join(puppet_bundler_install_dir, 'lib'))
72
53
  end
73
54
  end
74
55
 
75
56
  step "Hosts: create environments directory like AIO does" do
76
- hosts.each do |host|
57
+ agents.each do |host|
77
58
  codedir = host.puppet['codedir']
78
59
  on host, "mkdir -p #{codedir}/environments/production/manifests"
79
60
  on host, "mkdir -p #{codedir}/environments/production/modules"
@@ -1,10 +1,7 @@
1
1
  test_name 'Puppet User and Group' do
2
2
  hosts.each do |host|
3
-
4
3
  step "ensure puppet user and group added to all nodes because this is what the packages do" do
5
4
  on host, puppet("resource user puppet ensure=present")
6
- on host, puppet("resource group puppet ensure=present")
7
5
  end
8
-
9
6
  end
10
7
  end
data/tasks/ci.rake CHANGED
@@ -110,6 +110,11 @@ $project_SERVER:
110
110
  Similar to SERVER, but project specific. If you have only one project (i.e., hiera) that you
111
111
  want to pull from a different server then all the others, you could set HIERA_SERVER=179.0.0.1,
112
112
  and you would get back 'https://179.0.0.1/puppetlabs-hiera.git'.
113
+
114
+ RUNTIME_BRANCH:
115
+ Currently only used with git-based testing. This must correspond to a branch in the
116
+ puppet-agent repo. We use it to determine the tag of the agent-runtime package that
117
+ we want. We also use it to construct the agent-runtime archive name (ie agent-runtime-${branch}-${tag})
113
118
  EOS
114
119
 
115
120
  namespace :ci do
@@ -200,11 +205,15 @@ Run the acceptance tests against a git checkout.
200
205
 
201
206
  $ SHA=<full sha> bundle exec rake ci:test:git
202
207
 
203
- SHA should be the full SHA for the component. Other options:
208
+ SHA: for git based testing specifically, this can be a sha, a branch, or a tag.
204
209
 
205
210
  FORK: to test against your fork, defaults to 'puppetlabs'
206
211
 
207
212
  SERVER: to git fetch from an alternate GIT server, defaults to 'github.com'
213
+
214
+ RUNTIME_BRANCH: the branch of the agent-runtime package to grab, defaults to
215
+ 'master'. This tells us which branch of puppet-agent to get the runtime tag
216
+ from and helps us create the archive name when we go to curl it down.
208
217
  EOS
209
218
  task :git => ['ci:check_env', 'ci:gen_hosts'] do
210
219
  beaker_suite(:git)
@@ -251,15 +260,15 @@ def pre_suites(type)
251
260
  [
252
261
  "#{beaker_root}/setup/common/000-delete-puppet-when-none.rb",
253
262
  "#{beaker_root}/setup/aio/010_Install_Puppet_Agent.rb",
254
- "#{beaker_root}/setup/aio/011_Install_Puppet_Server.rb",
255
- "#{beaker_root}/setup/aio/012_Finalize_Installs.rb",
256
- "#{beaker_root}/setup/aio/020_InstallCumulusModules.rb",
257
- "#{beaker_root}/setup/aio/021_InstallAristaModuleMasters.rb",
258
- "#{beaker_root}/setup/aio/022_InstallAristaModuleAgents.rb",
263
+ "#{beaker_root}/setup/common/011_Install_Puppet_Server.rb",
264
+ "#{beaker_root}/setup/common/012_Finalize_Installs.rb",
265
+ "#{beaker_root}/setup/common/020_InstallCumulusModules.rb",
266
+ "#{beaker_root}/setup/common/021_InstallAristaModuleMasters.rb",
267
+ "#{beaker_root}/setup/common/022_InstallAristaModuleAgents.rb",
259
268
  "#{beaker_root}/setup/common/025_StopFirewall.rb",
260
269
  "#{beaker_root}/setup/common/030_StopSssd.rb",
261
270
  "#{beaker_root}/setup/common/040_ValidateSignCert.rb",
262
- "#{beaker_root}/setup/aio/045_EnsureMasterStarted.rb",
271
+ "#{beaker_root}/setup/common/045_EnsureMasterStarted.rb",
263
272
  ]
264
273
  when :gem
265
274
  [
@@ -271,13 +280,13 @@ def pre_suites(type)
271
280
  "#{beaker_root}/setup/common/000-delete-puppet-when-none.rb",
272
281
  "#{beaker_root}/setup/git/000_EnvSetup.rb",
273
282
  "#{beaker_root}/setup/git/010_TestSetup.rb",
274
- "#{beaker_root}/setup/git/011_SetMaster.rb",
283
+ "#{beaker_root}/setup/common/011_Install_Puppet_Server.rb",
275
284
  "#{beaker_root}/setup/git/020_PuppetUserAndGroup.rb",
285
+ "#{beaker_root}/setup/git/070_InstallCACerts.rb",
276
286
  "#{beaker_root}/setup/common/025_StopFirewall.rb",
277
- "#{beaker_root}/setup/git/030_PuppetMasterSanity.rb",
287
+ "#{beaker_root}/setup/common/030_StopSssd.rb",
278
288
  "#{beaker_root}/setup/common/040_ValidateSignCert.rb",
279
- "#{beaker_root}/setup/git/060_InstallModules.rb",
280
- "#{beaker_root}/setup/git/070_InstallCACerts.rb",
289
+ "#{beaker_root}/setup/common/045_EnsureMasterStarted.rb",
281
290
  ]
282
291
  end
283
292
  presuites.join(',')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker-puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-25 00:00:00.000000000 Z
11
+ date: 2018-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -271,22 +271,20 @@ files:
271
271
  - lib/beaker/dsl/install_utils/module_utils.rb
272
272
  - lib/beaker/dsl/install_utils/puppet_utils.rb
273
273
  - setup/aio/010_Install_Puppet_Agent.rb
274
- - setup/aio/011_Install_Puppet_Server.rb
275
- - setup/aio/012_Finalize_Installs.rb
276
- - setup/aio/020_InstallCumulusModules.rb
277
- - setup/aio/021_InstallAristaModuleMasters.rb
278
- - setup/aio/022_InstallAristaModuleAgents.rb
279
- - setup/aio/045_EnsureMasterStarted.rb
280
274
  - setup/common/000-delete-puppet-when-none.rb
275
+ - setup/common/011_Install_Puppet_Server.rb
276
+ - setup/common/012_Finalize_Installs.rb
277
+ - setup/common/020_InstallCumulusModules.rb
278
+ - setup/common/021_InstallAristaModuleMasters.rb
279
+ - setup/common/022_InstallAristaModuleAgents.rb
281
280
  - setup/common/025_StopFirewall.rb
282
281
  - setup/common/030_StopSssd.rb
283
282
  - setup/common/040_ValidateSignCert.rb
283
+ - setup/common/045_EnsureMasterStarted.rb
284
284
  - setup/gem/010_GemInstall.rb
285
285
  - setup/git/000_EnvSetup.rb
286
286
  - setup/git/010_TestSetup.rb
287
- - setup/git/011_SetMaster.rb
288
287
  - setup/git/020_PuppetUserAndGroup.rb
289
- - setup/git/030_PuppetMasterSanity.rb
290
288
  - setup/git/060_InstallModules.rb
291
289
  - setup/git/070_InstallCACerts.rb
292
290
  - spec/beaker-puppet/helpers/facter_helpers_spec.rb
@@ -1,15 +0,0 @@
1
- test_name 'Hosts: create basic puppet.conf' do
2
- skip_test 'not testing with puppetserver' unless @options['is_puppetserver']
3
- hosts.each do |host|
4
- confdir = host.puppet['confdir']
5
- on host, "mkdir -p #{confdir}"
6
- puppetconf = File.join(confdir, 'puppet.conf')
7
-
8
- if host['roles'].include?('agent')
9
- on host, "echo '[agent]' > '#{puppetconf}' && " +
10
- "echo server=#{master} >> '#{puppetconf}'"
11
- else
12
- on host, "touch '#{puppetconf}'"
13
- end
14
- end
15
- end
@@ -1,20 +0,0 @@
1
- test_name "Puppet Master sanity checks: PID file and SSL dir creation"
2
-
3
- skip_test 'not testing with puppetserver' unless @options['is_puppetserver']
4
-
5
- hostname = on(master, 'facter hostname').stdout.strip
6
- fqdn = on(master, 'facter fqdn').stdout.strip
7
-
8
- with_puppet_running_on(master, :main => { :dns_alt_names => "puppet,#{hostname},#{fqdn}", :verbose => true, :noop => true }) do
9
- # SSL dir created?
10
- step "SSL dir created?"
11
- on master, "[ -d #{master.puppet('master')['ssldir']} ]"
12
-
13
- # PID file exists?
14
- step "PID file created?"
15
- on master, "[ -f #{master.puppet('master')['pidfile']} ]"
16
- end
17
-
18
- step "Create module directories normally handled via packaging"
19
- on master, "mkdir -p #{master['distmoduledir']}"
20
- on master, "mkdir -p #{master['sitemoduledir']}"