beaker-pe 2.17.0 → 2.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/beaker-pe/install/pe_utils.rb +225 -0
- data/lib/beaker-pe/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91b77453890c3f2af4eecb5a655e069e902d6061ca8724b7bee3c14de7d7c584
|
4
|
+
data.tar.gz: e5675b005b3061014800b7dbc1a49576ed9c561de139db7dd84ea57770c756f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39fb9fa81be0a7f5fb6970086ded2dd2104c8c68a81b31cc34c31b62a0199d7772089c207f3c495318b5d5526bba13b4a69666a14ff9430354067f8ed20f059e
|
7
|
+
data.tar.gz: 8f65cad0d0e2657594e55ba0ca5cf36af231f2451ea281d51e62fa4d42ec6a3988f234c874a3a5cb6badffa02a6aab29a2279dbd656d725999efc1eb2ef2627a
|
data/Gemfile.lock
CHANGED
@@ -891,6 +891,231 @@ module Beaker
|
|
891
891
|
end
|
892
892
|
end
|
893
893
|
|
894
|
+
# Gets host-specific information for PE promoted puppet-agent packages (Mac version)
|
895
|
+
#
|
896
|
+
# @param [Host] host
|
897
|
+
# @param [String] puppet_collection Name of the puppet collection to use
|
898
|
+
# @param [Hash{Symbol=>String}] opts Options hash to provide extra values
|
899
|
+
#
|
900
|
+
# @return [String, String, String] Host-specific information for packages
|
901
|
+
# 1. release_path_end Suffix for the release_path. Used on Windows. Check
|
902
|
+
# {Windows::Pkg#pe_puppet_agent_promoted_package_info} to see usage.
|
903
|
+
# 2. release_file Path to the file on release build servers
|
904
|
+
# 3. download_file Filename for the package itself
|
905
|
+
def pe_puppet_agent_promoted_package_info_mac(host, puppet_collection = nil, opts = {} )
|
906
|
+
error_message = "Must provide %s argument to get puppet agent dev package information"
|
907
|
+
raise ArgumentError, error_message % "puppet_collection" unless puppet_collection
|
908
|
+
|
909
|
+
variant, version, arch, _codename = host['platform'].to_array
|
910
|
+
release_file = "/repos/apple/#{version}/#{puppet_collection}/#{arch}/puppet-agent-*"
|
911
|
+
|
912
|
+
# macOS puppet-agent tarballs haven't always included arch
|
913
|
+
agent_version = opts[:puppet_agent_version]
|
914
|
+
agent_version_f = agent_version&.to_f
|
915
|
+
|
916
|
+
download_file = if agent_version_f.nil? || (agent_version_f < 6.28 || (agent_version_f >= 7.0 && agent_version_f < 7.18))
|
917
|
+
"puppet-agent-#{variant}-#{version}.tar.gz"
|
918
|
+
else
|
919
|
+
"puppet-agent-#{variant}-#{version}-#{arch}.tar.gz"
|
920
|
+
end
|
921
|
+
|
922
|
+
return '', release_file, download_file
|
923
|
+
end
|
924
|
+
|
925
|
+
# Gets host-specific information for PE promoted puppet-agent packages (Windows version)
|
926
|
+
#
|
927
|
+
# @param [Host] host
|
928
|
+
# @param [String] puppet_collection Name of the puppet collection to use
|
929
|
+
# @param [Hash{Symbol=>String}] opts Options hash to provide extra values
|
930
|
+
#
|
931
|
+
# @return [String, String, String] Host-specific information for packages
|
932
|
+
# 1. release_path_end Suffix for the release_path
|
933
|
+
# 2. release_file Path to the file on release build servers
|
934
|
+
# 3. download_file Filename for the package itself
|
935
|
+
def pe_puppet_agent_promoted_package_info_windows(host, _puppet_collection = nil, _opts = {} )
|
936
|
+
is_config_32 = host['ruby_arch'] == 'x86' || host['install_32'] || host['install_32']
|
937
|
+
should_install_64bit = host.is_x86_64? && !is_config_32
|
938
|
+
# only install 64bit builds if
|
939
|
+
# - we do not have install_32 set on host
|
940
|
+
# - we do not have install_32 set globally
|
941
|
+
arch_suffix = should_install_64bit ? '64' : '86'
|
942
|
+
release_path_end = "/windows"
|
943
|
+
release_file = "/puppet-agent-x#{arch_suffix}.msi"
|
944
|
+
download_file = "puppet-agent-x#{arch_suffix}.msi"
|
945
|
+
return release_path_end, release_file, download_file
|
946
|
+
end
|
947
|
+
|
948
|
+
# Gets host-specific information for PE promoted puppet-agent packages (Unix version)
|
949
|
+
#
|
950
|
+
# @param [Host] host
|
951
|
+
# @param [String] puppet_collection Name of the puppet collection to use
|
952
|
+
# @param [Hash{Symbol=>String}] opts Options hash to provide extra values
|
953
|
+
#
|
954
|
+
# @return [String, String, String] Host-specific information for packages
|
955
|
+
# 1. release_path_end Suffix for the release_path. Used on Windows. Check
|
956
|
+
# {Windows::Pkg#pe_puppet_agent_promoted_package_info} to see usage.
|
957
|
+
# 2. release_file Path to the file on release build servers
|
958
|
+
# 3. download_file Filename for the package itself
|
959
|
+
def pe_puppet_agent_promoted_package_info_unix(host, puppet_collection = nil, _opts = {} )
|
960
|
+
error_message = "Must provide %s argument to get puppet agent dev package information"
|
961
|
+
raise ArgumentError, error_message % "puppet_collection" unless puppet_collection
|
962
|
+
|
963
|
+
variant, version, arch, codename = host['platform'].to_array
|
964
|
+
case variant
|
965
|
+
when /^(fedora|el|centos|redhat|opensuse|sles)$/
|
966
|
+
variant = ((['centos', 'redhat'].include?(variant)) ? 'el' : variant)
|
967
|
+
release_file = "/repos/#{variant}/#{version}/#{puppet_collection}/#{arch}/puppet-agent-*.rpm"
|
968
|
+
download_file = "puppet-agent-#{variant}-#{version}-#{arch}.tar.gz"
|
969
|
+
when /^(debian|ubuntu|cumulus)$/
|
970
|
+
if arch == 'x86_64'
|
971
|
+
arch = 'amd64'
|
972
|
+
end
|
973
|
+
version = version[0,2] + '.' + version[2,2] if (variant.include?('ubuntu') && !version.include?("."))
|
974
|
+
release_file = "/repos/apt/#{codename}/pool/#{puppet_collection}/p/puppet-agent/puppet-agent*#{arch}.deb"
|
975
|
+
download_file = "puppet-agent-#{variant}-#{version}-#{arch}.tar.gz"
|
976
|
+
when /^solaris$/
|
977
|
+
if arch == 'x86_64'
|
978
|
+
arch = 'i386'
|
979
|
+
end
|
980
|
+
release_file = "/repos/solaris/#{version}/#{puppet_collection}/"
|
981
|
+
download_file = "puppet-agent-#{variant}-#{version}-#{arch}.tar.gz"
|
982
|
+
else
|
983
|
+
raise "No pe-promoted installation step for #{variant} yet..."
|
984
|
+
end
|
985
|
+
return '', release_file, download_file
|
986
|
+
end
|
987
|
+
|
988
|
+
def pe_puppet_agent_promoted_package_install_dispatch(host, onhost_copy_base, onhost_copied_download, onhost_copied_file, download_file, _opts)
|
989
|
+
case host
|
990
|
+
when Mac::Host
|
991
|
+
return pe_puppet_agent_promoted_package_install_mac(host, onhost_copy_base, onhost_copied_download, onhost_copied_file, download_file, _opts)
|
992
|
+
when Unix::Host
|
993
|
+
return pe_puppet_agent_promoted_package_install_unix(host, onhost_copy_base, onhost_copied_download, onhost_copied_file, download_file, _opts)
|
994
|
+
end
|
995
|
+
raise RuntimeError("#{host.class} not one of Beaker::(Mac|Unix)::Host")
|
996
|
+
end
|
997
|
+
|
998
|
+
# Installs a given PE promoted package on a Mac host
|
999
|
+
#
|
1000
|
+
# @param [Host] host Host to install package on
|
1001
|
+
# @param [String] onhost_copy_base Base copy directory on the host
|
1002
|
+
# @param [String] onhost_copied_download Downloaded file path on the host
|
1003
|
+
# @param [String] onhost_copied_file Copied file path once un-compressed
|
1004
|
+
# @param [String] download_file File name of the downloaded file
|
1005
|
+
# @param [Hash{Symbol=>String}] opts additional options
|
1006
|
+
#
|
1007
|
+
# @return nil
|
1008
|
+
def pe_puppet_agent_promoted_package_install_mac(
|
1009
|
+
host, onhost_copy_base, onhost_copied_download, onhost_copied_file, _download_file, _opts
|
1010
|
+
)
|
1011
|
+
host.execute("tar -zxvf #{onhost_copied_download} -C #{onhost_copy_base}")
|
1012
|
+
# move to better location
|
1013
|
+
host.execute("mv #{onhost_copied_file}.dmg .")
|
1014
|
+
host.install_package("puppet-agent-*")
|
1015
|
+
end
|
1016
|
+
|
1017
|
+
|
1018
|
+
# Installs a given PE promoted package on a Unix host
|
1019
|
+
#
|
1020
|
+
# @param [Host] host Host to install package on
|
1021
|
+
# @param [String] onhost_copy_base Base copy directory on the host
|
1022
|
+
# @param [String] onhost_copied_download Downloaded file path on the host
|
1023
|
+
# @param [String] onhost_copied_file Copied file path once un-compressed
|
1024
|
+
# @param [String] download_file File name of the downloaded file
|
1025
|
+
# @param [Hash{Symbol=>String}] opts additional options
|
1026
|
+
#
|
1027
|
+
# @return nil
|
1028
|
+
def pe_puppet_agent_promoted_package_install_unix(
|
1029
|
+
host, onhost_copy_base, onhost_copied_download, onhost_copied_file, download_file, _opts
|
1030
|
+
)
|
1031
|
+
host.uncompress_local_tarball(onhost_copied_download, onhost_copy_base, download_file )
|
1032
|
+
if /^solaris/.match?(host['platform'])
|
1033
|
+
# above uncompresses the install from .tar.gz -> .p5p into the
|
1034
|
+
# onhost_copied_file directory w/a weird name. We have to read that file
|
1035
|
+
# name from the filesystem, so that we can provide it to install_local...
|
1036
|
+
pkg_filename = host.execute( "ls #{onhost_copied_file}" )
|
1037
|
+
onhost_copied_file = "#{onhost_copied_file}#{pkg_filename}"
|
1038
|
+
end
|
1039
|
+
|
1040
|
+
host.install_local_package(onhost_copied_file, onhost_copy_base )
|
1041
|
+
nil
|
1042
|
+
end
|
1043
|
+
|
1044
|
+
def pe_puppet_agent_promoted_package_info_dispatch(host, puppet_collection = nil, opts = {})
|
1045
|
+
case host
|
1046
|
+
when Windows::Host
|
1047
|
+
return pe_puppet_agent_promoted_package_info_windows(host, puppet_collection, opts)
|
1048
|
+
when Mac::Host
|
1049
|
+
return pe_puppet_agent_promoted_package_info_mac(host, puppet_collection, opts)
|
1050
|
+
when Unix::Host
|
1051
|
+
return pe_puppet_agent_promoted_package_info_unix(host, puppet_collection, opts)
|
1052
|
+
end
|
1053
|
+
raise RuntimeError("#{host.class} not one of Beaker::(Windows|Mac|Unix)::Host")
|
1054
|
+
end
|
1055
|
+
|
1056
|
+
# Install shared repo of the puppet-agent on the given host(s). Downloaded from
|
1057
|
+
# location of the form PE_PROMOTED_BUILDS_URL/PE_VER/puppet-agent/AGENT_VERSION/repo
|
1058
|
+
#
|
1059
|
+
# @param [Host, Array<Host>, String, Symbol] hosts One or more hosts to act upon,
|
1060
|
+
# or a role (String or Symbol) that identifies one or more hosts.
|
1061
|
+
# @param [Hash{Symbol=>String}] opts An options hash
|
1062
|
+
# @option opts [String] :puppet_agent_version The version of puppet-agent to install, defaults to 'latest'
|
1063
|
+
# @option opts [String] :pe_ver The version of PE (will also use host['pe_ver']), defaults to '4.0'
|
1064
|
+
# @option opts [String] :copy_base_local Directory where puppet-agent artifact
|
1065
|
+
# will be stored locally
|
1066
|
+
# (default: 'tmp/repo_configs')
|
1067
|
+
# @option opts [String] :copy_dir_external Directory where puppet-agent
|
1068
|
+
# artifact will be pushed to on the external machine
|
1069
|
+
# (default: '/root')
|
1070
|
+
# @option opts [String] :puppet_collection Defaults to 'PC1'
|
1071
|
+
# @option opts [String] :pe_promoted_builds_url Base URL to pull artifacts from
|
1072
|
+
def install_puppet_agent_pe_promoted_repo_on(hosts, opts)
|
1073
|
+
opts[:puppet_agent_version] ||= 'latest'
|
1074
|
+
|
1075
|
+
block_on hosts do |host|
|
1076
|
+
pe_ver = host[:pe_ver] || opts[:pe_ver] || '4.0.0-rc1'
|
1077
|
+
opts = sanitize_opts(opts)
|
1078
|
+
opts[:download_url] =
|
1079
|
+
"#{opts[:pe_promoted_builds_url]}/puppet-agent/#{pe_ver}/#{opts[:puppet_agent_version]}/repos"
|
1080
|
+
opts[:copy_base_local] ||= File.join('tmp', 'repo_configs')
|
1081
|
+
opts[:copy_dir_external] ||= host.external_copy_base
|
1082
|
+
opts[:puppet_collection] ||= puppet_collection_for(:puppet_agent, opts[:puppet_agent_version])
|
1083
|
+
add_role(host, 'aio') # we are installing agent, so we want aio role
|
1084
|
+
release_path = opts[:download_url]
|
1085
|
+
variant, version, arch, codename = host['platform'].to_array
|
1086
|
+
copy_dir_local = File.join(opts[:copy_base_local], variant)
|
1087
|
+
onhost_copy_base = opts[:copy_dir_external]
|
1088
|
+
|
1089
|
+
release_path_end, release_file, download_file =
|
1090
|
+
pe_puppet_agent_promoted_package_info_dispatch(
|
1091
|
+
host,
|
1092
|
+
opts[:puppet_collection], opts
|
1093
|
+
)
|
1094
|
+
release_path << release_path_end
|
1095
|
+
|
1096
|
+
onhost_copied_download = File.join(onhost_copy_base, download_file)
|
1097
|
+
onhost_copied_file = File.join(onhost_copy_base, release_file)
|
1098
|
+
fetch_http_file(release_path, download_file, copy_dir_local)
|
1099
|
+
scp_to host, File.join(copy_dir_local, download_file), onhost_copy_base
|
1100
|
+
|
1101
|
+
if variant == 'windows'
|
1102
|
+
result = on host, "echo #{onhost_copied_file}"
|
1103
|
+
onhost_copied_file = result.raw_output.chomp
|
1104
|
+
opts = { debug: host[:pe_debug] || opts[:pe_debug] }
|
1105
|
+
# couldn't pull this out, because it's relying on
|
1106
|
+
# {Beaker::DSL::InstallUtils::WindowsUtils} methods,
|
1107
|
+
# which I didn't want to attack right now. TODO
|
1108
|
+
install_msi_on(host, onhost_copied_file, {}, opts)
|
1109
|
+
else
|
1110
|
+
pe_puppet_agent_promoted_package_install_dispatch(
|
1111
|
+
host,
|
1112
|
+
onhost_copy_base, onhost_copied_download,
|
1113
|
+
onhost_copied_file, download_file, opts
|
1114
|
+
)
|
1115
|
+
end
|
1116
|
+
configure_type_defaults_on(host)
|
1117
|
+
end
|
1118
|
+
end
|
894
1119
|
|
895
1120
|
def generic_install hosts, opts = {}
|
896
1121
|
step "Installing PE on a generic set of hosts"
|
data/lib/beaker-pe/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaker-pe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppetlabs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|