Skip to content

Commit

Permalink
Remove install_puppet_agent_* methods
Browse files Browse the repository at this point in the history
These were moved to beaker-puppet, but weren't removed here. They are
also Puppetlabs specific, so don't belong in beaker itself.
  • Loading branch information
ekohl committed Mar 2, 2023
1 parent 5bfed84 commit cdaedad
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 868 deletions.
14 changes: 2 additions & 12 deletions docs/how_to/hosts/eos.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,10 @@

EOS is the network device OS from Arista. You can get more details from their [product page](https://www.arista.com/en/products/eos).

It reaches out to the EOS-specific host code for any information that it needs. You can check out [these methods](blob/master/lib/beaker/host/eos.rb) if you need more information about this.

# Hypervisors

EOS has only been developed and tested as a [vmpooler](https://github.com/puppetlabs/vmpooler) host.

This doesn't mean that it can't be used in another hypervisor, but that Beaker doesn't specifically deal with the details of that hypervisor in creating EOS hosts, if there is anything specific to EOS that will need to be done in provisioning steps.

# Installation Methods

## Puppet Enterprise

`install_pe` should "just work".

## Open Source

In order to install a puppet-agent against an EOS host, you'll have to use the [`install_puppet_agent_dev_repo_on`](blob/master/lib/beaker/dsl/install_utils/foss_utils.rb#L1085) method.

It reaches out to the EOS-specific host code for any information that it needs. You can check out [these methods](blob/master/lib/beaker/host/eos.rb) if you need more information about this.
18 changes: 0 additions & 18 deletions docs/how_to/install_puppet.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,3 @@ For our different Open Source variants, check out the sections just below, which
### Released Open Source Puppet Agents

To install a released version of Puppet Agent, beaker provides the [`install_puppet_agent_on`](http://www.rubydoc.info/gems/beaker/Beaker/DSL/InstallUtils/FOSSUtils#install_puppet_agent_on-instance_method) method. Please checkout the Rubydocs for more info on this method.

### Development Open Source Puppet Agents

To install a development build of Puppet Agent, beaker provides the [`install_puppet_agent_dev_repo_on`](http://www.rubydoc.info/gems/beaker/Beaker/DSL/InstallUtils/FOSSUtils#install_puppet_agent_dev_repo_on-instance_method) method. Please checkout the Rubydocs for more info on this method.

### PE Promoted Agent Installs

If you're using this method, then you're going to be downloading the installer from a URL configured like so:

```ruby
http://pm.puppetlabs.com/puppet-agent/#{ pe_version }/#{ puppet_agent_version }/repos
```

`pe_version` is a variable that you can provide using either the host or global property `:pe_ver`. This is usually done in the hosts file, and will default to `4.0.0-rc1` if nothing is specified.

`puppet_agent_version` is a variable you can provide the value of through the same methods as `pe_version` above. It will default to `latest`.

Beaker's DSL method to install from this location is [`install_puppet_agent_pe_promoted_repo_on`](http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/DSL/InstallUtils/FOSSUtils#install_puppet_agent_pe_promoted_repo_on-instance_method). Follow the link to get API-level docs on this method for more info.
27 changes: 1 addition & 26 deletions lib/beaker/host/eos.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,6 @@

module Eos
class Host < Unix::Host

# Gets the path & file name for the puppet agent dev package on EOS
#
# @param [String] puppet_collection Name of the puppet collection to use
# @param [String] puppet_agent_version Version of puppet agent to get
# @param [Hash{Symbol=>String}] opts Options hash to provide extra values
#
# @note EOS doesn't use any additional options at this time, but does require
# both puppet_collection & puppet_agent_version, & will fail without them
#
# @raise [ArgumentError] If one of the two required parameters (puppet_collection,
# puppet_agent_version) is either not passed or set to nil
#
# @return [String, String] Path to the directory and filename of the package, respectively
def puppet_agent_dev_package_info( puppet_collection = nil, puppet_agent_version = nil, _opts = {} )
error_message = "Must provide %s argument to get puppet agent dev package information"
raise ArgumentError, error_message % "puppet_collection" unless puppet_collection
raise ArgumentError, error_message % "puppet_agent_version" unless puppet_agent_version

variant, version, arch, _ = self['platform'].to_array
release_path = "#{variant}/#{version}/#{puppet_collection}/#{arch}"
release_file = "puppet-agent-#{puppet_agent_version}-1.#{variant}#{version}.#{arch}.swix"
return release_path, release_file
end

# Copies a remote file to the host location specified
#
# @param [String] remote_url URL to the remote file
Expand Down Expand Up @@ -56,4 +31,4 @@ def install_from_file( filename )
end

end
end
end
92 changes: 0 additions & 92 deletions lib/beaker/host/mac/pkg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,96 +47,4 @@ def determine_if_x86_64
result = exec(Beaker::Command.new("uname -a | grep x86_64"), :expect_all_exit_codes => true)
result.exit_code == 0
end

# Gets the path & file name for the puppet agent dev package on OSX
#
# @param [String] puppet_collection Name of the puppet collection to use
# @param [String] puppet_agent_version Version of puppet agent to get
# @param [Hash{Symbol=>String}] opts Options hash to provide extra values
#
# @note OSX does require :download_url to be set on the opts argument
# in order to check for builds on the builds server
#
# @raise [ArgumentError] If one of the two required parameters (puppet_collection,
# puppet_agent_version) is either not passed or set to nil
#
# @return [String, String] Path to the directory and filename of the package, respectively
def puppet_agent_dev_package_info( puppet_collection = nil, puppet_agent_version = nil, opts = {} )
error_message = "Must provide %s argument to get puppet agent dev package information"
raise ArgumentError, error_message % "puppet_collection" unless puppet_collection
raise ArgumentError, error_message % "puppet_agent_version" unless puppet_agent_version
raise ArgumentError, error_message % "opts[:download_url]" unless opts[:download_url]

variant, version, arch, codename = self['platform'].to_array

mac_pkg_name = "puppet-agent-#{puppet_agent_version}"
version = version[0,2] + '.' + version[2,2] unless version.include?(".")
# newest hotness
path_chunk = "apple/#{version}/#{puppet_collection}/#{arch}"
release_path_end = path_chunk
# moved to doing this when 'el capitan' came out & the objection was
# raised that the code name wasn't a fact, & as such can be hard to script
# example: puppet-agent-0.1.0-1.osx10.9.dmg
release_file = "#{mac_pkg_name}-1.osx#{version}.dmg"
if not link_exists?("#{opts[:download_url]}/#{release_path_end}/#{release_file}") # new hotness
# little older change involved the code name as only difference from above
# example: puppet-agent-0.1.0-1.mavericks.dmg
release_file = "#{mac_pkg_name}-1.#{codename}.dmg"
end
if not link_exists?("#{opts[:download_url]}/#{release_path_end}/#{release_file}") # oops, try the old stuff
release_path_end = "apple/#{puppet_collection}"
# example: puppet-agent-0.1.0-osx-10.9-x86_64.dmg
release_file = "#{mac_pkg_name}-#{variant}-#{version}-x86_64.dmg"
end
return release_path_end, release_file
end

# Gets host-specific information for PE promoted puppet-agent packages
#
# @param [String] puppet_collection Name of the puppet collection to use
# @param [Hash{Symbol=>String}] opts Options hash to provide extra values
#
# @return [String, String, String] Host-specific information for packages
# 1. release_path_end Suffix for the release_path. Used on Windows. Check
# {Windows::Pkg#pe_puppet_agent_promoted_package_info} to see usage.
# 2. release_file Path to the file on release build servers
# 3. download_file Filename for the package itself
def pe_puppet_agent_promoted_package_info( puppet_collection = nil, opts = {} )
error_message = "Must provide %s argument to get puppet agent dev package information"
raise ArgumentError, error_message % "puppet_collection" unless puppet_collection

variant, version, arch, _codename = self['platform'].to_array
release_file = "/repos/apple/#{version}/#{puppet_collection}/#{arch}/puppet-agent-*"

# macOS puppet-agent tarballs haven't always included arch
agent_version = opts[:puppet_agent_version]
agent_version_f = agent_version&.to_f

download_file = if agent_version_f.nil? || (agent_version_f < 6.28 || (agent_version_f >= 7.0 && agent_version_f < 7.18))
"puppet-agent-#{variant}-#{version}.tar.gz"
else
"puppet-agent-#{variant}-#{version}-#{arch}.tar.gz"
end

return '', release_file, download_file
end

# Installs a given PE promoted package on a host
#
# @param [String] onhost_copy_base Base copy directory on the host
# @param [String] onhost_copied_download Downloaded file path on the host
# @param [String] onhost_copied_file Copied file path once un-compressed
# @param [String] download_file File name of the downloaded file
# @param [Hash{Symbol=>String}] opts additional options
#
# @return nil
def pe_puppet_agent_promoted_package_install(
onhost_copy_base, onhost_copied_download, onhost_copied_file, _download_file, _opts
)
execute("tar -zxvf #{onhost_copied_download} -C #{onhost_copy_base}")
# move to better location
execute("mv #{onhost_copied_file}.dmg .")
self.install_package("puppet-agent-*")
end

end
175 changes: 0 additions & 175 deletions lib/beaker/host/unix/pkg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -264,181 +264,6 @@ def extract_rpm_proxy_options(url)
end
end

# Gets the path & file name for the puppet agent dev package on Unix
#
# @param [String] puppet_collection Name of the puppet collection to use
# @param [String] puppet_agent_version Version of puppet agent to get
# @param [Hash{Symbol=>String}] opts Options hash to provide extra values
#
# @note Solaris does require :download_url to be set on the opts argument
# in order to check for builds on the builds server
#
# @raise [ArgumentError] If one of the two required parameters (puppet_collection,
# puppet_agent_version) is either not passed or set to nil
#
# @return [String, String] Path to the directory and filename of the package, respectively
def solaris_puppet_agent_dev_package_info( puppet_collection = nil, puppet_agent_version = nil, opts = {} )
error_message = "Must provide %s argument to get puppet agent package information"
raise ArgumentError, error_message % "puppet_collection" unless puppet_collection
raise ArgumentError, error_message % "puppet_agent_version" unless puppet_agent_version
raise ArgumentError, error_message % "opts[:download_url]" unless opts[:download_url]

variant, version, arch, _codename = self['platform'].to_array

version = version.split('.')[0] # packages are only published for major versions

platform_error = "Incorrect platform '#{variant}' for #solaris_puppet_agent_dev_package_info"
raise ArgumentError, platform_error if variant != 'solaris'

if arch == 'x86_64'
arch = 'i386'
end
release_path_end = "solaris/#{version}/#{puppet_collection}"
solaris_revision_conjunction = '-'
revision = '1'
if version == '10'
solaris_release_version = ''
pkg_suffix = 'pkg.gz'
solaris_name_conjunction = '-'
component_version = puppet_agent_version
elsif version == '11'
# Ref:
# http://www.oracle.com/technetwork/articles/servers-storage-admin/ips-package-versioning-2232906.html
#
# Example to show package name components:
# Full package name: puppet-agent@1.2.5.38.6813,5.11-1.sparc.p5p
# Schema: <component-name><solaris_name_conjunction><component_version><solaris_release_version><solaris_revision_conjunction><revision>.<arch>.<pkg_suffix>
solaris_release_version = ',5.11' # injecting comma to prevent from adding another var
pkg_suffix = 'p5p'
solaris_name_conjunction = '@'
component_version = puppet_agent_version.dup
component_version.gsub!(/[a-zA-Z]/, '')
component_version.gsub!(/(^-)|(-$)/, '')
# Here we strip leading 0 from version components but leave
# singular 0 on their own.
component_version = component_version.split('-').join('.')
component_version = component_version.split('.').map(&:to_i).join('.')
end
release_file_base = "puppet-agent#{solaris_name_conjunction}#{component_version}#{solaris_release_version}"
release_file_end = "#{arch}.#{pkg_suffix}"
release_file = "#{release_file_base}#{solaris_revision_conjunction}#{revision}.#{release_file_end}"
if not link_exists?("#{opts[:download_url]}/#{release_path_end}/#{release_file}")
release_file = "#{release_file_base}.#{release_file_end}"
end
return release_path_end, release_file
end

# Gets the path & file name for the puppet agent dev package on Unix
#
# @param [String] puppet_collection Name of the puppet collection to use
# @param [String] puppet_agent_version Version of puppet agent to get
# @param [Hash{Symbol=>String}] opts Options hash to provide extra values
#
# @note Solaris & OSX do require some options to be set. See
# {#solaris_puppet_agent_dev_package_info} &
# {Mac::Pkg#puppet_agent_dev_package_info} for more details
#
# @raise [ArgumentError] If one of the two required parameters (puppet_collection,
# puppet_agent_version) is either not passed or set to nil
#
# @return [String, String] Path to the directory and filename of the package, respectively
def puppet_agent_dev_package_info( puppet_collection = nil, puppet_agent_version = nil, opts = {} )
error_message = "Must provide %s argument to get puppet agent dev package information"
raise ArgumentError, error_message % "puppet_collection" unless puppet_collection
raise ArgumentError, error_message % "puppet_agent_version" unless puppet_agent_version

variant, version, arch, _codename = self['platform'].to_array

case variant
when /^(solaris)$/
release_path_end, release_file = solaris_puppet_agent_dev_package_info(
puppet_collection, puppet_agent_version, opts )
when /^(opensuse|sles|aix|el|centos|oracle|redhat|scientific)$/
variant = 'el' if variant.match?(/(?:el|centos|oracle|redhat|scientific)/)
variant = 'sles' if variant == 'opensuse'

if variant == 'aix'
arch = 'ppc' if arch == 'power'
version_x, version_y = /^(\d+)\.(\d+)/.match(puppet_agent_version).captures.map(&:to_i)
if version_x < 5 || version_x == 5 && version_y < 99 # 5.99.z indicates pre-release puppet6
version = '7.1' if version == '7.2'
else
version = '6.1'
end
end
release_path_end = "#{variant}/#{version}/#{puppet_collection}/#{arch}"
release_file = "puppet-agent-#{puppet_agent_version}-1.#{variant}#{version}.#{arch}.rpm"
else
msg = "puppet_agent dev package info unknown for platform '#{self['platform']}'"
raise ArgumentError, msg
end
return release_path_end, release_file
end

# Gets host-specific information for PE promoted puppet-agent packages
#
# @param [String] puppet_collection Name of the puppet collection to use
# @param [Hash{Symbol=>String}] opts Options hash to provide extra values
#
# @return [String, String, String] Host-specific information for packages
# 1. release_path_end Suffix for the release_path. Used on Windows. Check
# {Windows::Pkg#pe_puppet_agent_promoted_package_info} to see usage.
# 2. release_file Path to the file on release build servers
# 3. download_file Filename for the package itself
def pe_puppet_agent_promoted_package_info( puppet_collection = nil, _opts = {} )
error_message = "Must provide %s argument to get puppet agent dev package information"
raise ArgumentError, error_message % "puppet_collection" unless puppet_collection

variant, version, arch, codename = self['platform'].to_array
case variant
when /^(fedora|el|centos|redhat|opensuse|sles)$/
variant = ((['centos', 'redhat'].include?(variant)) ? 'el' : variant)
release_file = "/repos/#{variant}/#{version}/#{puppet_collection}/#{arch}/puppet-agent-*.rpm"
download_file = "puppet-agent-#{variant}-#{version}-#{arch}.tar.gz"
when /^(debian|ubuntu|cumulus)$/
if arch == 'x86_64'
arch = 'amd64'
end
version = version[0,2] + '.' + version[2,2] if (variant.include?('ubuntu') && !version.include?("."))
release_file = "/repos/apt/#{codename}/pool/#{puppet_collection}/p/puppet-agent/puppet-agent*#{arch}.deb"
download_file = "puppet-agent-#{variant}-#{version}-#{arch}.tar.gz"
when /^solaris$/
if arch == 'x86_64'
arch = 'i386'
end
release_file = "/repos/solaris/#{version}/#{puppet_collection}/"
download_file = "puppet-agent-#{variant}-#{version}-#{arch}.tar.gz"
else
raise "No pe-promoted installation step for #{variant} yet..."
end
return '', release_file, download_file
end

# Installs a given PE promoted package on a host
#
# @param [String] onhost_copy_base Base copy directory on the host
# @param [String] onhost_copied_download Downloaded file path on the host
# @param [String] onhost_copied_file Copied file path once un-compressed
# @param [String] download_file File name of the downloaded file
# @param [Hash{Symbol=>String}] opts additional options
#
# @return nil
def pe_puppet_agent_promoted_package_install(
onhost_copy_base, onhost_copied_download, onhost_copied_file, download_file, _opts
)
uncompress_local_tarball( onhost_copied_download, onhost_copy_base, download_file )
if /^solaris/.match?(self['platform'])
# above uncompresses the install from .tar.gz -> .p5p into the
# onhost_copied_file directory w/a weird name. We have to read that file
# name from the filesystem, so that we can provide it to install_local...
pkg_filename = execute( "ls #{onhost_copied_file}" )
onhost_copied_file = "#{onhost_copied_file}#{pkg_filename}"
end

install_local_package( onhost_copied_file, onhost_copy_base )
nil
end

# Installs a package already located on a SUT
#
# @param [String] onhost_package_file Path to the package file to install
Expand Down
Loading

0 comments on commit cdaedad

Please sign in to comment.