Class: PuppetMetadata::Beaker
- Inherits:
-
Object
- Object
- PuppetMetadata::Beaker
- Defined in:
- lib/puppet_metadata/beaker.rb
Overview
A class to provide abstractions for integration with beaker
Constant Summary collapse
- PIDFILE_COMPATIBLE_IMAGES =
These images have an older systemd, which they work with PIDFile parameter
{ 'CentOS' => { '7' => 'centos:7.6.1810', }, 'Ubuntu' => { '16.04' => 'ubuntu:xenial-20191212', }, }.freeze
- PIDFILE_INCOMPATIBLE =
There is no CentOS 8 image that works with PIDFile in systemd unit files
{ 'CentOS' => ['8'], }.freeze
Class Method Summary collapse
-
.os_release_to_setfile(os, release, use_fqdn: false, pidfile_workaround: false) ⇒ nil, Array<(String, String)>
Convert an Operating System name with a release to a Beaker setfile.
-
.os_supported?(os) ⇒ Boolean
Return whether a Beaker setfile can be generated for the given OS.
Class Method Details
.os_release_to_setfile(os, release, use_fqdn: false, pidfile_workaround: false) ⇒ nil, Array<(String, String)>
Convert an Operating System name with a release to a Beaker setfile
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/puppet_metadata/beaker.rb', line 42 def os_release_to_setfile(os, release, use_fqdn: false, pidfile_workaround: false) return unless os_supported?(os) name = "#{os.downcase}#{release.tr('.', '')}-64" = {} [:hostname] = "#{name}.example.com" if use_fqdn # Docker messes up cgroups and some systemd versions can't deal with # that when PIDFile is used. if pidfile_workaround?(pidfile_workaround, os) return if PIDFILE_INCOMPATIBLE[os]&.include?(release) if (image = PIDFILE_COMPATIBLE_IMAGES.dig(os, release)) [:image] = image end end human_name = "#{os} #{release}" [build_setfile(name, ), human_name] end |
.os_supported?(os) ⇒ Boolean
Return whether a Beaker setfile can be generated for the given OS
67 68 69 |
# File 'lib/puppet_metadata/beaker.rb', line 67 def os_supported?(os) ['Archlinux', 'CentOS', 'Fedora', 'Debian', 'Ubuntu'].include?(os) end |