Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 53 additions & 9 deletions lib/beaker_puppet_helpers/install_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,23 @@ module BeakerPuppetHelpers
class InstallUtils
# @api private
REPOS = {
release: {
apt: 'https://apt.puppet.com',
yum: 'https://yum.puppet.com',
openvox: {
release: {
apt: 'https://apt.voxpupuli.org/',
yum: 'https://yum.voxpupuli.org/',
},
# no nightlies yet, but soon!
nightly: {},
},
nightly: {
apt: 'https://nightlies.puppet.com/apt',
yum: 'https://nightlies.puppet.com/yum',
puppet: {
release: {
apt: 'https://apt.puppet.com',
yum: 'https://yum.puppet.com',
},
nightly: {
apt: 'https://nightlies.puppet.com/apt',
yum: 'https://nightlies.puppet.com/yum',
},
},
}.freeze

Expand All @@ -24,17 +34,21 @@ class InstallUtils
#
# @param [Beaker::Host] host
# A host to act upon.
#
# @param [String] collection
# The collection to install. The default (puppet) is the latest
# available version.
# available version. Can also be openvox7, puppet8 and others.
# Method is called from beaker_install_helpers
#
# @param [Boolean] nightly
# Whether to install nightly or release packages
#
# @note This method only works on redhat-like and debian-like hosts. There
# are no official Puppet releases for other platforms.
#
def self.install_puppet_release_repo_on(host, collection = 'puppet', nightly: false)
repos = REPOS[nightly ? :nightly : :release]
requirement_name = collection.gsub(/\d+/, '')
repos = REPOS[requirement_name.to_sym][nightly ? :nightly : :release]

variant, version, _arch = host['packaging_platform'].split('-', 3)

Expand All @@ -56,7 +70,8 @@ def self.install_puppet_release_repo_on(host, collection = 'puppet', nightly: fa
url = "#{repos[:yum]}/#{collection}-release-#{variant}-#{version}.noarch.rpm"
host.install_package(url)
when 'debian', 'ubuntu'
url = "#{repos[:apt]}/#{collection}-release-#{host['platform'].codename}.deb"
relname = (requirement_name == 'openvox') ? "#{variant}#{version}" : host['platform'].codename
url = "#{repos[:apt]}/#{collection}-release-#{relname}.deb"
wget_on(host, url) do |filename|
host.install_package(filename)
end
Expand All @@ -69,6 +84,28 @@ def self.install_puppet_release_repo_on(host, collection = 'puppet', nightly: fa
end
end

# Determine if we need the Perforce or OpenVox Package name
#
# @param [Beaker::Host] host
# The host to act on
# @param [Boolean] prefer_aio
# Whether to prefer AIO packages or OS packages
# @param implementation
# If we are on OpenVox or Perforce
# @return [String] the package name
def self.package_name(host, prefer_aio: true, implementation: 'openvox')
case implementation
when 'openvox'
openvox_package_name
when 'puppet'
puppet_package_name(host, prefer_aio: prefer_aio)
when 'none'
'puppet'
else
raise StandardError, "Unknown requirement '#{implementation}'"
end
end

# Determine the Puppet package name
#
# @param [Beaker::Host] host
Expand All @@ -93,6 +130,13 @@ def self.puppet_package_name(host, prefer_aio: true)
end
end

# Determine the openvox package name
#
# @return [String] The openvox package name
def self.openvox_package_name
'openvox-agent'
end

# @param [Beaker::Host] host
# The host to act on
# @api private
Expand Down
Loading