beaker-puppet 0.17.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +21 -0
- data/acceptance/pre_suite/gem/install.rb +2 -0
- data/acceptance/pre_suite/git/install.rb +2 -6
- data/acceptance/pre_suite/pkg/install.rb +2 -0
- data/acceptance/tests/README.md +2 -0
- data/acceptance/tests/clone_git_repo_on_test.rb +43 -0
- data/acceptance/tests/create_tmpdir_on_test.rb +47 -0
- data/acceptance/tests/install_smoke_test.rb +2 -0
- data/acceptance/tests/stub_host.rb +2 -0
- data/acceptance/tests/web_helpers_test.rb +2 -0
- data/acceptance/tests/with_puppet_running_on.rb +2 -0
- data/beaker-puppet.gemspec +3 -0
- data/lib/beaker-puppet.rb +14 -25
- data/lib/beaker-puppet/helpers/puppet_helpers.rb +49 -0
- data/lib/beaker-puppet/install_utils/foss_utils.rb +2 -1
- data/lib/beaker-puppet/install_utils/puppet5.rb +185 -183
- data/lib/beaker-puppet/install_utils/windows_utils.rb +223 -0
- data/lib/beaker-puppet/version.rb +1 -1
- data/spec/beaker-puppet/helpers/facter_helpers_spec.rb +1 -1
- data/spec/beaker-puppet/helpers/puppet_helpers_spec.rb +92 -2
- data/spec/beaker-puppet/helpers/tk_helpers_spec.rb +1 -3
- data/spec/beaker-puppet/install_utils/ezbake_utils_spec.rb +279 -0
- data/spec/beaker-puppet/install_utils/module_utils_spec.rb +2 -0
- data/spec/beaker-puppet/install_utils/puppet5_spec.rb +1 -1
- data/spec/beaker-puppet/install_utils/windows_utils_spec.rb +263 -0
- data/spec/beaker-puppet/wrappers_spec.rb +34 -0
- metadata +22 -3
- data/acceptance/lib/beaker/acceptance/install_utils.rb +0 -58
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 175a3e08fbd658bd3d8de3b2887bd0528d81bece
|
4
|
+
data.tar.gz: d9705d9cd91f355d1d275c1404f5c358a960820e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5fc2e1b4252e692f8e5f8022093603aa609994751502ef9042739e7752bad2c679932f52ba89638444a871c908cd27153a1be0d8794d28720788f0fd00eb38e
|
7
|
+
data.tar.gz: f705cc01f0635e048e5c3e4e14311822eee1b5ba95369a8a650af0afdcb854321f3e7956872199d96e55beb46cca7071fae96c72dabbcad74c53e9cd569fab28
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -9,6 +9,27 @@ of beaker, please do, we would love any help that you'd like to provide.
|
|
9
9
|
|
10
10
|
# How Do I Use This?
|
11
11
|
|
12
|
+
## With Beaker 3.x
|
13
|
+
|
14
|
+
This library is included as a dependency of Beaker 3.x versions and is automatically included, so there's nothing to do.
|
15
|
+
|
16
|
+
## With Beaker 4.x
|
17
|
+
|
18
|
+
As of Version 1.0 of `beaker-puppet`, the minimum supported version of beaker is Version 4.0. If you use `ENV['BEAKER_VERSION']`, you will have to ensure that this is compatible, and that if you are using a local Git repository it is up to date.
|
19
|
+
|
20
|
+
As of beaker 4.0, all hypervisor and DSL extension libraries have been removed and are no longer dependencies. In order to use a specific hypervisor or DSL extension library in your project, you will need to include them alongside Beaker in your Gemfile or project.gemspec. E.g.
|
21
|
+
|
22
|
+
~~~ruby
|
23
|
+
# Gemfile
|
24
|
+
gem 'beaker', '~>4.0'
|
25
|
+
gem 'beaker-puppet', '~>1.0'
|
26
|
+
# project.gemspec
|
27
|
+
s.add_runtime_dependency 'beaker', '~>4.0'
|
28
|
+
s.add_runtime_dependency 'beaker-puppet', '~>1.0'
|
29
|
+
~~~
|
30
|
+
|
31
|
+
For DSL Extension Libraries, you must also ensure that you `require` the library in your test files. You can do this manually in individual test files or in a test helper (if you have one). You can [use `Bundler.require()`](https://bundler.io/v1.16/guides/groups.html) to require the library automatically.
|
32
|
+
|
12
33
|
### Right Now? (beaker 3.x)
|
13
34
|
|
14
35
|
At this point, beaker-puppet is included in beaker, so you don't have to _do_
|
@@ -1,7 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
extend Beaker::Acceptance::InstallUtils
|
4
|
-
end
|
1
|
+
require 'beaker-puppet'
|
2
|
+
|
5
3
|
test_name 'Puppet git pre-suite'
|
6
4
|
|
7
5
|
install = [
|
@@ -10,8 +8,6 @@ install = [
|
|
10
8
|
'puppet#3.8.7'
|
11
9
|
]
|
12
10
|
|
13
|
-
SourcePath = Beaker::DSL::InstallUtils::SourcePath
|
14
|
-
|
15
11
|
PACKAGES = {
|
16
12
|
:redhat => [
|
17
13
|
'git',
|
data/acceptance/tests/README.md
CHANGED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'beaker-puppet'
|
2
|
+
|
3
|
+
confine :except, :platform => /^solaris-10/
|
4
|
+
|
5
|
+
test_name 'Clone from git' do
|
6
|
+
|
7
|
+
PACKAGES = {
|
8
|
+
:redhat => [
|
9
|
+
'git',
|
10
|
+
],
|
11
|
+
:debian => [
|
12
|
+
['git', 'git-core'],
|
13
|
+
],
|
14
|
+
:solaris_11 => [
|
15
|
+
['git', 'developer/versioning/git'],
|
16
|
+
],
|
17
|
+
:solaris_10 => [
|
18
|
+
'coreutils',
|
19
|
+
'curl', # update curl to fix "CURLOPT_SSL_VERIFYHOST no longer supports 1 as value!" issue
|
20
|
+
'git',
|
21
|
+
],
|
22
|
+
:windows => [
|
23
|
+
'git',
|
24
|
+
],
|
25
|
+
:sles => [
|
26
|
+
'git-core',
|
27
|
+
]
|
28
|
+
}
|
29
|
+
|
30
|
+
|
31
|
+
install_packages_on(hosts, PACKAGES, :check_if_exists => true)
|
32
|
+
|
33
|
+
# implicitly tests build_giturl() and lookup_in_env()
|
34
|
+
hosts.each do |host|
|
35
|
+
on host, "echo #{GitHubSig} >> $HOME/.ssh/known_hosts"
|
36
|
+
testdir = host.tmpdir(File.basename(__FILE__))
|
37
|
+
|
38
|
+
step 'should be able to successfully clone a git repo' do
|
39
|
+
results = clone_git_repo_on(host, "#{testdir}", extract_repo_info_from(build_git_url('hiera')))
|
40
|
+
assert_match( %r{From.*github\.com[:/]puppetlabs/hiera}, result.output, 'Did not find clone')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
test_name "dsl::helpers::host_helpers #create_tmpdir_on" do
|
2
|
+
step "#create_tmpdir_on returns a temporary directory on the remote system" do
|
3
|
+
tmpdir = create_tmpdir_on default
|
4
|
+
assert_match %r{/}, tmpdir
|
5
|
+
assert_equal 0, on(default, "touch #{tmpdir}/testfile").exit_code
|
6
|
+
end
|
7
|
+
|
8
|
+
step "#create_tmpdir_on uses the specified path prefix when provided" do
|
9
|
+
tmpdir = create_tmpdir_on(default, "mypathprefix")
|
10
|
+
assert_match %r{/mypathprefix}, tmpdir
|
11
|
+
assert_equal 0, on(default, "touch #{tmpdir}/testfile").exit_code
|
12
|
+
end
|
13
|
+
|
14
|
+
step "#create_tmpdir_on fails if a non-existent user is specified" do
|
15
|
+
assert_raises Beaker::Host::CommandFailure do
|
16
|
+
tmpdir = create_tmpdir_on default, '', 'fakeuser'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
step "#create_tmpdir_on sets the user if specified" do
|
21
|
+
default.user_present('tmpdirtestuser')
|
22
|
+
tmpdir = create_tmpdir_on(default, nil, 'tmpdirtestuser', nil)
|
23
|
+
assert_match /tmpdirtestuser/, on(default, "ls -ld #{tmpdir}").output
|
24
|
+
default.user_absent('tmpdirtestuser')
|
25
|
+
end
|
26
|
+
|
27
|
+
step "#create_tmpdir_on fails if a non-existent group is specified" do
|
28
|
+
assert_raises Beaker::Host::CommandFailure do
|
29
|
+
tmpdir = create_tmpdir_on default, '', nil, 'fakegroup'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
step "#create_tmpdir_on sets the group if specified" do
|
34
|
+
default.group_present('tmpdirtestgroup')
|
35
|
+
tmpdir = create_tmpdir_on(default, nil, nil, 'tmpdirtestgroup')
|
36
|
+
assert_match /testgroup/, on(default, "ls -ld #{tmpdir}").output
|
37
|
+
default.group_absent('tmpdirtestgroup')
|
38
|
+
end
|
39
|
+
|
40
|
+
step "#create_tmpdir_on operates on all hosts if given a hosts array" do
|
41
|
+
tmpdirs = create_tmpdir_on hosts
|
42
|
+
hosts.zip(tmpdirs).each do |(host, tmpdir)|
|
43
|
+
assert_match %r{/}, tmpdir
|
44
|
+
assert_equal 0, on(host, "touch #{tmpdir}/testfile").exit_code
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/beaker-puppet.gemspec
CHANGED
@@ -25,6 +25,9 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.add_development_dependency 'simplecov'
|
26
26
|
s.add_development_dependency 'pry', '~> 0.10'
|
27
27
|
|
28
|
+
# Acceptance Testing Dependencies
|
29
|
+
s.add_development_dependency 'beaker-vmpooler'
|
30
|
+
|
28
31
|
# Documentation dependencies
|
29
32
|
s.add_development_dependency 'yard'
|
30
33
|
s.add_development_dependency 'markdown'
|
data/lib/beaker-puppet.rb
CHANGED
@@ -8,7 +8,7 @@ require 'beaker-puppet/helpers/rake_helpers'
|
|
8
8
|
[ 'aio', 'foss' ].each do |lib|
|
9
9
|
require "beaker-puppet/install_utils/#{lib}_defaults"
|
10
10
|
end
|
11
|
-
[ 'foss', 'puppet', 'ezbake', 'module' ].each do |lib|
|
11
|
+
[ 'windows', 'foss', 'puppet', 'ezbake', 'module' ].each do |lib|
|
12
12
|
require "beaker-puppet/install_utils/#{lib}_utils"
|
13
13
|
end
|
14
14
|
[ 'tk', 'facter', 'puppet' ].each do |lib|
|
@@ -19,34 +19,23 @@ require 'beaker-puppet/install_utils/puppet5'
|
|
19
19
|
|
20
20
|
|
21
21
|
module BeakerPuppet
|
22
|
-
|
23
|
-
|
24
|
-
include Beaker::DSL::InstallUtils::AIODefaults
|
22
|
+
include Beaker::DSL::InstallUtils::FOSSDefaults
|
23
|
+
include Beaker::DSL::InstallUtils::AIODefaults
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
25
|
+
include Beaker::DSL::InstallUtils::WindowsUtils
|
26
|
+
include Beaker::DSL::InstallUtils::PuppetUtils
|
27
|
+
include Beaker::DSL::InstallUtils::FOSSUtils
|
28
|
+
include Beaker::DSL::InstallUtils::EZBakeUtils
|
29
|
+
include Beaker::DSL::InstallUtils::ModuleUtils
|
30
30
|
|
31
|
-
|
32
|
-
end
|
31
|
+
include Beaker::DSL::InstallUtils::Puppet5
|
33
32
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
include Beaker::DSL::Helpers::PuppetHelpers
|
38
|
-
end
|
33
|
+
include Beaker::DSL::Helpers::TKHelpers
|
34
|
+
include Beaker::DSL::Helpers::FacterHelpers
|
35
|
+
include Beaker::DSL::Helpers::PuppetHelpers
|
39
36
|
|
40
37
|
include Beaker::DSL::Wrappers
|
41
38
|
end
|
42
39
|
|
43
|
-
|
44
|
-
|
45
|
-
# # First we register our module with the Beaker DSL
|
46
|
-
# Beaker::DSL.register( Beaker::DSL::Puppet )
|
47
|
-
#
|
48
|
-
# # Modules added into a module which has previously been included are not
|
49
|
-
# # retroactively included in the including class.
|
50
|
-
# #
|
51
|
-
# # https://github.com/adrianomitre/retroactive_module_inclusion
|
52
|
-
# Beaker::TestCase.class_eval { include Beaker::DSL }
|
40
|
+
# Register the DSL extension
|
41
|
+
Beaker::DSL.register( BeakerPuppet )
|
@@ -865,6 +865,55 @@ module Beaker
|
|
865
865
|
sign_certificate_for(default)
|
866
866
|
end
|
867
867
|
|
868
|
+
# Create a temp directory on remote host, optionally owned by specified user and group.
|
869
|
+
#
|
870
|
+
# @param [Host, Array<Host>, String, Symbol] hosts One or more hosts to act upon,
|
871
|
+
# or a role (String or Symbol) that identifies one or more hosts.
|
872
|
+
# @param [String] path_prefix A remote path prefix for the new temp directory.
|
873
|
+
# @param [String] user The name of user that should own the temp directory. If
|
874
|
+
# not specified, uses default permissions from tmpdir creation.
|
875
|
+
# @param [String] group The name of group that should own the temp directory.
|
876
|
+
# If not specified, uses default permissions from tmpdir creation.
|
877
|
+
#
|
878
|
+
# @return [String, Array<String>] Returns the name of the newly-created dir, or
|
879
|
+
# an array of names of newly-created dirs per-host
|
880
|
+
#
|
881
|
+
# @note While tempting, this method should not be "optimized" to coalesce calls to
|
882
|
+
# chown user:group when both options are passed, as doing so will muddy the spec.
|
883
|
+
def create_tmpdir_on(hosts, path_prefix = '', user = nil, group = nil)
|
884
|
+
block_on hosts do | host |
|
885
|
+
# create the directory
|
886
|
+
dir = host.tmpdir(path_prefix)
|
887
|
+
# only chown if explicitly passed; don't make assumptions about perms
|
888
|
+
# only `chown user` for cleaner codepaths
|
889
|
+
if user
|
890
|
+
# ensure user exists
|
891
|
+
if not host.user_get(user).success?
|
892
|
+
# clean up
|
893
|
+
host.rm_rf("#{dir}")
|
894
|
+
raise "User #{user} does not exist on #{host}."
|
895
|
+
end
|
896
|
+
# chown only user
|
897
|
+
host.chown(user, dir)
|
898
|
+
# on host, "chown #{user} #{dir}"
|
899
|
+
end
|
900
|
+
# only chgrp if explicitly passed; don't make assumptions about perms
|
901
|
+
if group
|
902
|
+
# ensure group exists
|
903
|
+
if not host.group_get(group).success?
|
904
|
+
# clean up
|
905
|
+
# on host, "rmdir #{dir}"
|
906
|
+
host.rm_rf(dir)
|
907
|
+
raise "Group #{group} does not exist on #{host}."
|
908
|
+
end
|
909
|
+
# chgrp
|
910
|
+
# on host, "chgrp #{group} #{dir}"
|
911
|
+
host.chgrp(group, dir)
|
912
|
+
end
|
913
|
+
dir
|
914
|
+
end
|
915
|
+
end
|
916
|
+
|
868
917
|
# Create a temp directory on remote host with a user. Default user
|
869
918
|
# is puppet master user.
|
870
919
|
#
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require "beaker/
|
1
|
+
require "beaker-puppet/install_utils/windows_utils"
|
2
2
|
[ 'aio', 'foss' ].each do |lib|
|
3
3
|
require "beaker-puppet/install_utils/#{lib}_defaults"
|
4
4
|
end
|
@@ -1414,6 +1414,7 @@ module Beaker
|
|
1414
1414
|
:solaris_11 => /solaris-11/,
|
1415
1415
|
:windows => /windows/,
|
1416
1416
|
:eos => /^eos-/,
|
1417
|
+
:sles => /sles/,
|
1417
1418
|
}.freeze
|
1418
1419
|
|
1419
1420
|
check_if_exists = options[:check_if_exists]
|
@@ -1,209 +1,211 @@
|
|
1
1
|
require 'beaker/dsl/install_utils/foss_defaults'
|
2
2
|
|
3
|
-
module
|
4
|
-
module
|
5
|
-
module
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
3
|
+
module Beaker
|
4
|
+
module DSL
|
5
|
+
module InstallUtils
|
6
|
+
module Puppet5
|
7
|
+
|
8
|
+
include Beaker::DSL::InstallUtils::FOSSDefaults
|
9
|
+
|
10
|
+
# grab build json from the builds server
|
11
|
+
#
|
12
|
+
# @param [String] sha_yaml_url URL to the <SHA>.yaml file containing the
|
13
|
+
# build details
|
14
|
+
#
|
15
|
+
# @return [Hash{String=>String}] build json parsed into a ruby hash
|
16
|
+
def fetch_build_details(sha_yaml_url)
|
17
|
+
dst_folder = Dir.mktmpdir
|
18
|
+
sha_yaml_filename = File.basename( sha_yaml_url )
|
19
|
+
sha_yaml_folder_url = File.dirname( sha_yaml_url )
|
20
|
+
|
21
|
+
sha_yaml_file_local_path = fetch_http_file(
|
22
|
+
sha_yaml_folder_url,
|
23
|
+
sha_yaml_filename,
|
24
|
+
dst_folder
|
25
|
+
)
|
26
|
+
file_hash = YAML.load_file( sha_yaml_file_local_path )
|
27
|
+
|
28
|
+
return sha_yaml_folder_url, file_hash[:platform_data]
|
29
|
+
end
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
31
|
+
# Get the host's packaging platform, based on beaker-hostgenerator's
|
32
|
+
# osinfo hash and the environment. Set ENV['BEAKER_PACKAGING_PLATFORMS']
|
33
|
+
# to override the default packaging platform specified by
|
34
|
+
# beaker-hostgenerator. This should be a comma-separated string with
|
35
|
+
# entries of the format `<host-platform>=<override-platform>`
|
36
|
+
#
|
37
|
+
# @param [Host] host Host whose packaging platform to determine
|
38
|
+
# @return [String] The packaging platform
|
39
|
+
def host_packaging_platform(host)
|
40
|
+
packaging_platform = host[:packaging_platform]
|
41
|
+
if ENV['BEAKER_PACKAGING_PLATFORMS']
|
42
|
+
overrides = Hash[ENV['BEAKER_PACKAGING_PLATFORMS'].split(',').map { |e| e.split('=') }]
|
43
|
+
logger.debug("Found packaging platform overrides: #{overrides}")
|
44
|
+
if overrides[host[:platform]]
|
45
|
+
platform = overrides[host[:platform]]
|
46
|
+
logger.debug("Default beaker packaging platform '#{host[:packaging_platform]}' for '#{host[:platform]}' overridden as '#{platform}'")
|
47
|
+
packaging_platform = platform
|
48
|
+
end
|
47
49
|
end
|
50
|
+
packaging_platform
|
48
51
|
end
|
49
|
-
packaging_platform
|
50
|
-
end
|
51
52
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
53
|
+
# Gets the artifact & repo_config URLs for this host in the build.
|
54
|
+
#
|
55
|
+
# @param [Host] host Host to get artifact URL for
|
56
|
+
# @param [Hash] build_details Details of the build in a hash
|
57
|
+
# @param [String] build_url URL to the build
|
58
|
+
#
|
59
|
+
# @return [String, String] URL to the build artifact, URL to the repo_config
|
60
|
+
# (nil if there is no repo_config for this platform for this build)
|
61
|
+
def host_urls(host, build_details, build_url)
|
62
|
+
packaging_platform = host_packaging_platform(host)
|
63
|
+
if packaging_platform.nil?
|
64
|
+
message = <<-EOF
|
65
|
+
:packaging_platform not provided for host '#{host}', platform '#{host[:platform]}'
|
66
|
+
:packaging_platform should be the platform-specific key from this list:
|
67
|
+
#{ build_details.keys }
|
68
|
+
EOF
|
69
|
+
fail_test( message )
|
70
|
+
end
|
70
71
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
72
|
+
logger.debug("Platforms available for this build:")
|
73
|
+
logger.debug("#{ build_details.keys }")
|
74
|
+
logger.debug("PLATFORM SPECIFIC INFO for #{host} (packaging name '#{packaging_platform}'):")
|
75
|
+
packaging_data = build_details[packaging_platform]
|
76
|
+
logger.debug("- #{ packaging_data }, isnil? #{ packaging_data.nil? }")
|
77
|
+
if packaging_data.nil?
|
78
|
+
message = <<-EOF
|
79
|
+
:packaging_platform '#{packaging_platform}' for host '#{host}' not in build details
|
80
|
+
:packaging_platform should be the platform-specific key from this list:
|
81
|
+
#{ build_details.keys }
|
82
|
+
EOF
|
83
|
+
fail_test( message )
|
84
|
+
end
|
84
85
|
|
85
|
-
|
86
|
-
|
87
|
-
|
86
|
+
artifact_buildserver_path = packaging_data[:artifact]
|
87
|
+
repoconfig_buildserver_path = packaging_data[:repo_config]
|
88
|
+
fail_test('no artifact_buildserver_path found') if artifact_buildserver_path.nil?
|
88
89
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
90
|
+
artifact_url = "#{build_url}/#{artifact_buildserver_path}"
|
91
|
+
repoconfig_url = "#{build_url}/#{repoconfig_buildserver_path}" unless repoconfig_buildserver_path.nil?
|
92
|
+
artifact_url_correct = link_exists?( artifact_url )
|
93
|
+
logger.debug("- artifact url: '#{artifact_url}'. Exists? #{artifact_url_correct}")
|
94
|
+
fail_test('artifact url built incorrectly') if !artifact_url_correct
|
94
95
|
|
95
|
-
|
96
|
-
|
96
|
+
return artifact_url, repoconfig_url
|
97
|
+
end
|
97
98
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
99
|
+
# install build artifact on the given host
|
100
|
+
#
|
101
|
+
# @param [Host] host Host to install artifact on
|
102
|
+
# @param [String] artifact_url URL of the project install artifact
|
103
|
+
# @param [String] project_name Name of project for artifact. Needed for OSX installs
|
104
|
+
#
|
105
|
+
# @return nil
|
106
|
+
def install_artifact_on(host, artifact_url, project_name)
|
107
|
+
variant, version, _, _ = host[:platform].to_array
|
108
|
+
case variant
|
109
|
+
when 'eos'
|
110
|
+
host.get_remote_file(artifact_url)
|
111
|
+
onhost_package_file = File.basename(artifact_url)
|
112
|
+
# TODO Will be refactored into {Beaker::Host#install_local_package}
|
113
|
+
# immediately following this work. The release timing makes it
|
114
|
+
# necessary to have this here separately for a short while
|
115
|
+
host.install_from_file(onhost_package_file)
|
116
|
+
when 'solaris'
|
117
|
+
artifact_filename = File.basename(artifact_url)
|
118
|
+
artifact_folder = File.dirname(artifact_url)
|
119
|
+
fetch_http_file(artifact_folder, artifact_filename, '.')
|
120
|
+
onhost_package_dir = host.tmpdir('puppet_installer')
|
121
|
+
scp_to host, artifact_filename, onhost_package_dir
|
122
|
+
onhost_package_file = "#{onhost_package_dir}/#{artifact_filename}"
|
123
|
+
host.install_local_package(onhost_package_file, '.')
|
124
|
+
when 'osx'
|
125
|
+
on host, "curl -O #{artifact_url}"
|
126
|
+
onhost_package_file = "#{project_name}*"
|
127
|
+
host.install_local_package(onhost_package_file)
|
128
|
+
when 'windows'
|
129
|
+
if project_name == 'puppet-agent'
|
130
|
+
install_msi_on(host, artifact_url)
|
131
|
+
else
|
132
|
+
generic_install_msi_on(host, artifact_url)
|
133
|
+
end
|
134
|
+
when 'aix'
|
135
|
+
artifact_filename = File.basename(artifact_url)
|
136
|
+
artifact_folder = File.dirname(artifact_url)
|
137
|
+
fetch_http_file(artifact_folder, artifact_filename, '.')
|
138
|
+
onhost_package_dir = host.tmpdir('puppet_installer')
|
139
|
+
scp_to host, artifact_filename, onhost_package_dir
|
140
|
+
onhost_package_file = "#{onhost_package_dir}/#{artifact_filename}"
|
141
|
+
|
142
|
+
# TODO Will be refactored into {Beaker::Host#install_local_package}
|
143
|
+
# immediately following this work. The release timing makes it
|
144
|
+
# necessary to have this here seperately for a short while
|
145
|
+
# NOTE: the AIX 7.1 package will only install on 7.2 with
|
146
|
+
# --ignoreos. This is a bug in package building on AIX 7.1's RPM
|
147
|
+
if version == "7.2"
|
148
|
+
aix_72_ignoreos_hack = "--ignoreos"
|
149
|
+
end
|
150
|
+
on host, "rpm -ivh #{aix_72_ignoreos_hack} #{onhost_package_file}"
|
130
151
|
else
|
131
|
-
|
152
|
+
host.install_package(artifact_url)
|
132
153
|
end
|
133
|
-
when 'aix'
|
134
|
-
artifact_filename = File.basename(artifact_url)
|
135
|
-
artifact_folder = File.dirname(artifact_url)
|
136
|
-
fetch_http_file(artifact_folder, artifact_filename, '.')
|
137
|
-
onhost_package_dir = host.tmpdir('puppet_installer')
|
138
|
-
scp_to host, artifact_filename, onhost_package_dir
|
139
|
-
onhost_package_file = "#{onhost_package_dir}/#{artifact_filename}"
|
140
|
-
|
141
|
-
# TODO Will be refactored into {Beaker::Host#install_local_package}
|
142
|
-
# immediately following this work. The release timing makes it
|
143
|
-
# necessary to have this here seperately for a short while
|
144
|
-
# NOTE: the AIX 7.1 package will only install on 7.2 with
|
145
|
-
# --ignoreos. This is a bug in package building on AIX 7.1's RPM
|
146
|
-
if version == "7.2"
|
147
|
-
aix_72_ignoreos_hack = "--ignoreos"
|
148
|
-
end
|
149
|
-
on host, "rpm -ivh #{aix_72_ignoreos_hack} #{onhost_package_file}"
|
150
|
-
else
|
151
|
-
host.install_package(artifact_url)
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
# Sets up the repo_configs on the host for this build
|
156
|
-
#
|
157
|
-
# @param [Host] host Host to install repo_configs on
|
158
|
-
# @param [String] repoconfig_url URL to the repo_config
|
159
|
-
#
|
160
|
-
# @return nil
|
161
|
-
def install_repo_configs_on(host, repoconfig_url)
|
162
|
-
if repoconfig_url.nil?
|
163
|
-
logger.warn("No repo_config for host '#{host}'. Skipping repo_config install")
|
164
|
-
return
|
165
154
|
end
|
166
155
|
|
167
|
-
|
168
|
-
|
156
|
+
# Sets up the repo_configs on the host for this build
|
157
|
+
#
|
158
|
+
# @param [Host] host Host to install repo_configs on
|
159
|
+
# @param [String] repoconfig_url URL to the repo_config
|
160
|
+
#
|
161
|
+
# @return nil
|
162
|
+
def install_repo_configs_on(host, repoconfig_url)
|
163
|
+
if repoconfig_url.nil?
|
164
|
+
logger.warn("No repo_config for host '#{host}'. Skipping repo_config install")
|
165
|
+
return
|
166
|
+
end
|
169
167
|
|
170
|
-
|
171
|
-
# from the provided YAML file located at the +sha_yaml_url+ parameter.
|
172
|
-
#
|
173
|
-
# @param [String] project_name Name of the project to install
|
174
|
-
# @param [String] sha_yaml_url URL to the <SHA>.yaml file containing the
|
175
|
-
# build details
|
176
|
-
# @param [String or Array] hosts Optional string or array of host or hosts to
|
177
|
-
# install on
|
178
|
-
#
|
179
|
-
# @note This install method only works for Puppet versions >= 5.0
|
180
|
-
#
|
181
|
-
# @return nil
|
182
|
-
def install_from_build_data_url(project_name, sha_yaml_url, local_hosts = nil)
|
183
|
-
if !link_exists?( sha_yaml_url )
|
184
|
-
message = <<-EOF
|
185
|
-
<SHA>.yaml URL '#{ sha_yaml_url }' does not exist.
|
186
|
-
Please update the `sha_yaml_url` parameter to the `puppet5_install` method.
|
187
|
-
EOF
|
188
|
-
fail_test( message )
|
168
|
+
install_repo_configs_from_url( host, repoconfig_url )
|
189
169
|
end
|
190
170
|
|
191
|
-
|
171
|
+
# Installs a specified puppet project on all hosts. Gets build information
|
172
|
+
# from the provided YAML file located at the +sha_yaml_url+ parameter.
|
173
|
+
#
|
174
|
+
# @param [String] project_name Name of the project to install
|
175
|
+
# @param [String] sha_yaml_url URL to the <SHA>.yaml file containing the
|
176
|
+
# build details
|
177
|
+
# @param [String or Array] hosts Optional string or array of host or hosts to
|
178
|
+
# install on
|
179
|
+
#
|
180
|
+
# @note This install method only works for Puppet versions >= 5.0
|
181
|
+
#
|
182
|
+
# @return nil
|
183
|
+
def install_from_build_data_url(project_name, sha_yaml_url, local_hosts = nil)
|
184
|
+
if !link_exists?( sha_yaml_url )
|
185
|
+
message = <<-EOF
|
186
|
+
<SHA>.yaml URL '#{ sha_yaml_url }' does not exist.
|
187
|
+
Please update the `sha_yaml_url` parameter to the `puppet5_install` method.
|
188
|
+
EOF
|
189
|
+
fail_test( message )
|
190
|
+
end
|
192
191
|
|
193
|
-
|
192
|
+
base_url, build_details = fetch_build_details( sha_yaml_url )
|
194
193
|
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
194
|
+
install_targets = local_hosts.nil? ? hosts : Array(local_hosts)
|
195
|
+
|
196
|
+
install_targets.each do |host|
|
197
|
+
artifact_url, repoconfig_url = host_urls( host, build_details, base_url )
|
198
|
+
if repoconfig_url.nil?
|
199
|
+
install_artifact_on( host, artifact_url, project_name )
|
200
|
+
else
|
201
|
+
install_repo_configs_on( host, repoconfig_url )
|
202
|
+
host.install_package( project_name )
|
203
|
+
end
|
204
|
+
configure_type_defaults_on( host )
|
202
205
|
end
|
203
|
-
configure_type_defaults_on( host )
|
204
206
|
end
|
205
|
-
end
|
206
207
|
|
208
|
+
end
|
207
209
|
end
|
208
210
|
end
|
209
211
|
end
|