Skip to content

Commit

Permalink
Remove methods dependent on removed Beaker methods
Browse files Browse the repository at this point in the history
Beaker removed all install_puppet_agent_* method in
voxpupuli/beaker@cdaedad. This commit removes beaker-puppet methods that
relied on those install_puppet_agent_* methods.

Co-authored-by: Tim Meusel <[email protected]>
  • Loading branch information
mhashizume and bastelfreak committed Feb 7, 2024
1 parent 27e6c0d commit 6cd04a6
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 639 deletions.
187 changes: 0 additions & 187 deletions lib/beaker-puppet/install_utils/foss_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1195,193 +1195,6 @@ def install_packages_from_local_dev_repo(host, package_name)
configure_type_defaults_on(host)
end

# Install development repo of the puppet-agent on the given host(s). Downloaded from
# location of the form DEV_BUILDS_URL/puppet-agent/AGENT_VERSION/repos
#
# @param [Host, Array<Host>, String, Symbol] hosts One or more hosts to act upon,
# or a role (String or Symbol) that identifies one or more hosts.
# @param [Hash{Symbol=>String}] opts An options hash
# @option opts [String] :puppet_agent_version The version of puppet-agent to install. This
# parameter is used by puppet with the +SUITE_VERSION+ environment
# variable to provide a `git describe` value to beaker to create a
# build server URL. Note that +puppet_agent_sha+ will still be used
# instead of this if a value is provided for that option
# @option opts [String] :puppet_agent_sha The sha of puppet-agent to install, defaults to provided
# puppet_agent_version
# @option opts [String] :copy_base_local Directory where puppet-agent artifact
# will be stored locally
# (default: 'tmp/repo_configs')
# @option opts [String] :copy_dir_external Directory where puppet-agent
# artifact will be pushed to on the external machine
# (default: '/root')
# @option opts [String] :puppet_collection Defaults to 'PC1'
# @option opts [String] :dev_builds_url Base URL to pull artifacts from
# @option opts [String] :copy_base_local Directory where puppet-agent artifact
# will be stored locally
# (default: 'tmp/repo_configs')
# @option opts [String] :copy_dir_external Directory where puppet-agent
# artifact will be pushed to on the external machine
# (default: '/root')
#
# @note on windows, the +:ruby_arch+ host parameter can determine in addition
# to other settings whether the 32 or 64bit install is used
#
# @example
# install_puppet_agent_dev_repo_on(host, { :puppet_agent_sha => 'd3377feaeac173aada3a2c2cedd141eb610960a7', :puppet_agent_version => '1.1.1.225.gd3377fe' })
#
# @return nil
def install_puppet_agent_dev_repo_on(hosts, global_opts)
global_opts[:puppet_agent_version] ||= global_opts[:version] # backward compatability
unless global_opts[:puppet_agent_version]
raise 'must provide :puppet_agent_version (puppet-agent version) for install_puppet_agent_dev_repo_on'
end

block_on hosts do |host|
opts = global_opts.dup

# TODO: consolidate these values as they serve no purpose from beaker's side
# you could provide any values you could to one to the other
puppet_agent_version = opts[:puppet_agent_sha] || opts[:puppet_agent_version]

opts = sanitize_opts(opts)
opts[:download_url] = "#{opts[:dev_builds_url]}/puppet-agent/#{puppet_agent_version}/repos/"
opts[:copy_base_local] ||= File.join('tmp', 'repo_configs')
opts[:puppet_collection] ||= 'PC1'

release_path = opts[:download_url]

variant, version, arch, codename = host['platform'].to_array
add_role(host, 'aio') # we are installing agent, so we want aio role
copy_dir_local = File.join(opts[:copy_base_local], variant)
onhost_copy_base = opts[:copy_dir_external] || host.external_copy_base

case variant
when /^(fedora|el|redhat|centos|debian|ubuntu|huaweios|cisco_nexus|cisco_ios_xr)$/
if arch == 's390x' || host['hypervisor'] == 'ec2'
logger.trace("#install_puppet_agent_dev_repo_on: unsupported host #{host} for repo detected. using dev package")
else
install_puppetlabs_dev_repo(host, 'puppet-agent', puppet_agent_version, nil, opts)
host.install_package('puppet-agent')
logger.trace('#install_puppet_agent_dev_repo_on: install_puppetlabs_dev_repo finished')
next
end
when /^(eos|osx|windows|solaris|sles|aix)$/
# Download installer package file & run install manually.
# Done below, so that el hosts with s390x arch or on ec2 can use this
# workflow as well
else
raise "No repository installation step for #{variant} yet..."
end

release_path_end, release_file = host.puppet_agent_dev_package_info(
opts[:puppet_collection], opts[:puppet_agent_version], opts
)
release_path << release_path_end
logger.trace('#install_puppet_agent_dev_repo_on: dev_package_info, continuing...')

if variant =~ /eos/
host.get_remote_file("#{release_path}/#{release_file}")
else
onhost_copied_file = File.join(onhost_copy_base, release_file)
fetch_http_file(release_path, release_file, copy_dir_local)
scp_to host, File.join(copy_dir_local, release_file), onhost_copy_base
end

case variant
when /^eos/
host.install_from_file(release_file)
when /^(sles|aix|fedora|el|redhat|centos)$/
# NOTE: AIX does not support repo management. This block assumes
# that the desired rpm has been mirrored to the 'repos' location.
# NOTE: the AIX 7.1 package will only install on 7.2 with
# --ignoreos. This is a bug in package building on AIX 7.1's RPM
aix_72_ignoreos_hack = '--ignoreos' if variant == 'aix' && version == '7.2'
on host, "rpm -ivh #{aix_72_ignoreos_hack} #{onhost_copied_file}"
when /^windows$/
result = on host, "echo #{onhost_copied_file}"
onhost_copied_file = result.raw_output.chomp
msi_opts = { debug: host[:pe_debug] || opts[:pe_debug] }
install_msi_on(host, onhost_copied_file, {}, msi_opts)
when /^osx$/
host.install_package("puppet-agent-#{opts[:puppet_agent_version]}*")
when /^solaris$/
host.solaris_install_local_package(release_file, onhost_copy_base)
end
configure_type_defaults_on(host)
end
end
alias install_puppetagent_dev_repo install_puppet_agent_dev_repo_on

# Install shared repo of the puppet-agent on the given host(s). Downloaded from
# location of the form PE_PROMOTED_BUILDS_URL/PE_VER/puppet-agent/AGENT_VERSION/repo
#
# @param [Host, Array<Host>, String, Symbol] hosts One or more hosts to act upon,
# or a role (String or Symbol) that identifies one or more hosts.
# @param [Hash{Symbol=>String}] opts An options hash
# @option opts [String] :puppet_agent_version The version of puppet-agent to install, defaults to 'latest'
# @option opts [String] :pe_ver The version of PE (will also use host['pe_ver']), defaults to '4.0'
# @option opts [String] :copy_base_local Directory where puppet-agent artifact
# will be stored locally
# (default: 'tmp/repo_configs')
# @option opts [String] :copy_dir_external Directory where puppet-agent
# artifact will be pushed to on the external machine
# (default: '/root')
# @option opts [String] :puppet_collection Defaults to 'PC1'
# @option opts [String] :pe_promoted_builds_url Base URL to pull artifacts from
#
# @note on windows, the +:ruby_arch+ host parameter can determine in addition
# to other settings whether the 32 or 64bit install is used
#
# @example
# install_puppet_agent_pe_promoted_repo_on(host, { :puppet_agent_version => '1.1.0.227', :pe_ver => '4.0.0-rc1'})
#
# @return nil
def install_puppet_agent_pe_promoted_repo_on(hosts, opts)
opts[:puppet_agent_version] ||= 'latest'

block_on hosts do |host|
pe_ver = host[:pe_ver] || opts[:pe_ver] || '4.0.0-rc1'
opts = sanitize_opts(opts)
opts[:download_url] =
"#{opts[:pe_promoted_builds_url]}/puppet-agent/#{pe_ver}/#{opts[:puppet_agent_version]}/repos"
opts[:copy_base_local] ||= File.join('tmp', 'repo_configs')
opts[:copy_dir_external] ||= host.external_copy_base
opts[:puppet_collection] ||= puppet_collection_for(:puppet_agent, opts[:puppet_agent_version])
add_role(host, 'aio') # we are installing agent, so we want aio role
release_path = opts[:download_url]
variant, version, arch, codename = host['platform'].to_array
copy_dir_local = File.join(opts[:copy_base_local], variant)
onhost_copy_base = opts[:copy_dir_external]

release_path_end, release_file, download_file =
host.pe_puppet_agent_promoted_package_info(
opts[:puppet_collection], opts
)
release_path << release_path_end

onhost_copied_download = File.join(onhost_copy_base, download_file)
onhost_copied_file = File.join(onhost_copy_base, release_file)
fetch_http_file(release_path, download_file, copy_dir_local)
scp_to host, File.join(copy_dir_local, download_file), onhost_copy_base

if variant == 'windows'
result = on host, "echo #{onhost_copied_file}"
onhost_copied_file = result.raw_output.chomp
opts = { debug: host[:pe_debug] || opts[:pe_debug] }
# couldn't pull this out, because it's relying on
# {Beaker::DSL::InstallUtils::WindowsUtils} methods,
# which I didn't want to attack right now. TODO
install_msi_on(host, onhost_copied_file, {}, opts)
else
host.pe_puppet_agent_promoted_package_install(
onhost_copy_base, onhost_copied_download,
onhost_copied_file, download_file, opts
)
end
configure_type_defaults_on(host)
end
end

# This method will install a pem file certificate on a windows host
#
# @param [Host] host A host object
Expand Down
Loading

0 comments on commit 6cd04a6

Please sign in to comment.