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
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
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/puppet_metadata/beaker.rb', line 25 def self.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 modern systemd can't deal with that when # PIDFile is used. if pidfile_workaround && (!pidfile_workaround.is_a?(Array) || pidfile_workaround.include?(os)) case os when 'CentOS' case release when '7' [:image] = 'centos:7.6.1810' when '8' # There is no CentOS 8 image that works with PIDFile in systemd # unit files return end when 'Ubuntu' [:image] = 'ubuntu:xenial-20191212' if release == '16.04' end end setfile = name setfile += "{#{options.map { |key, value| "#{key}=#{value}" }.join(',')}}" if .any? human_name = "#{os} #{release}" [setfile, human_name] end |
.os_supported?(os) ⇒ Boolean
Return whether a Beaker setfile can be generated for the given OS
61 62 63 |
# File 'lib/puppet_metadata/beaker.rb', line 61 def self.os_supported?(os) ['CentOS', 'Fedora', 'Debian', 'Ubuntu'].include?(os) end |