beaker-pe 3.1.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 693f432d697885bac0bbf91ee603bbb005c162bf75c4c27ec0efd6c3c9ecf079
4
- data.tar.gz: 04e017e7fdd6622f844f60fa0148eed5b5e7fccf46ca069df40de35a9bd0c571
3
+ metadata.gz: 6e1e3ee7449a81df4a5fecfdbf683c4714ae82739074879524840ef3853e3985
4
+ data.tar.gz: 8cc1a9ed940acc35e3d80326510a8e75720312cb868a0ff73ae79f8851539e56
5
5
  SHA512:
6
- metadata.gz: acc129fb982cc395411397be4bb5c221ca52c04141b59a0409d3920ff44590be01f3f857ae71a88953c80350c279ce23f14938641f9cf9eece4e6c9bbd9d73cf
7
- data.tar.gz: 881d008f7f9e436c6efc89b7f6bced1f7c4c1b6dc5b9334470dfb68f60ae1731e9111030dcb0c6b49b1baf3eee861ec16923a80d72d6329efacb605bfe818a0d
6
+ metadata.gz: d3c48ca519266a175533ae8572eb8940104e514690f0e4655d4788d6ed957d2a55e0eedefca6561a34e191fb253ad94d3a52d9c65533534b2e5ea656cba88b03
7
+ data.tar.gz: ed00460ff4f7c5d93096e578557c6f99c277575c11ca3637a51d59fdb45f42ada1d58669390b9d027e6d7fb4b4ad3f7a39e132457f53311ceeeabdb7196d99d8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- beaker-pe (3.1.0)
4
+ beaker-pe (3.2.0)
5
5
  beaker (>= 4.0, < 6)
6
6
  beaker-abs
7
7
  beaker-answers (~> 1.0)
@@ -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"
@@ -3,7 +3,7 @@ module Beaker
3
3
  module PE
4
4
 
5
5
  module Version
6
- STRING = '3.1.0'
6
+ STRING = '3.2.0'
7
7
  end
8
8
 
9
9
  end
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: 3.1.0
4
+ version: 3.2.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-05-22 00:00:00.000000000 Z
11
+ date: 2024-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec