puppet_metadata 1.0.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/puppet_metadata/aio.rb +21 -10
- data/lib/puppet_metadata/beaker.rb +63 -46
- data/lib/puppet_metadata/github_actions.rb +3 -21
- data/lib/puppet_metadata/operatingsystem.rb +45 -41
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1812a9565d5558aea69c47b403fd31788417b995ad8c4ef5349ddee10d18529c
|
4
|
+
data.tar.gz: 54dda6a4915469ce27d0d2b9a1c43fbcee5cfdc2314dfc3fa8358afca9d303da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49675f7c180f2300e05c3018cb6d0c9f064d74b5f95fee222d73e7f83c385a8b4a839779462163a11022f9c700d115839c1d79d239a0f5988a1cbf5c3dea344d
|
7
|
+
data.tar.gz: be883a1b3af62b048436c263afd6dc4a0963fc5345d9a8e69f63af96e52f84670c5ec1d63ef212a371ed2044f62e21f2c5a49e9016f0c1c108083a12efbd7a7e
|
data/lib/puppet_metadata/aio.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module PuppetMetadata
|
2
|
-
class AIO
|
2
|
+
class AIO
|
3
3
|
COMPATIBLE = {
|
4
4
|
'AlmaLinux' => 'RedHat',
|
5
5
|
'Amazon' => 'RedHat',
|
@@ -7,15 +7,16 @@ module PuppetMetadata
|
|
7
7
|
'OracleLinux' => 'RedHat',
|
8
8
|
'Rocky' => 'RedHat',
|
9
9
|
'Scientific' => 'RedHat',
|
10
|
-
}
|
10
|
+
}.freeze
|
11
11
|
|
12
|
-
BUILDS = {
|
12
|
+
BUILDS = {
|
13
13
|
# RPM-based
|
14
14
|
'RedHat' => {
|
15
15
|
'5' => 5..7,
|
16
16
|
'6' => 5..7,
|
17
17
|
'7' => 5..7,
|
18
18
|
'8' => 5..7,
|
19
|
+
'9' => 6..7,
|
19
20
|
},
|
20
21
|
'Fedora' => {
|
21
22
|
'26' => [5],
|
@@ -35,9 +36,10 @@ module PuppetMetadata
|
|
35
36
|
# deb-based
|
36
37
|
'Debian' => {
|
37
38
|
'7' => [5],
|
38
|
-
'8' => 5..
|
39
|
+
'8' => 5..6,
|
39
40
|
'9' => 5..7,
|
40
41
|
'10' => 5..7,
|
42
|
+
'11' => 6..7,
|
41
43
|
},
|
42
44
|
'Ubuntu' => {
|
43
45
|
'14.04' => 5..6,
|
@@ -45,14 +47,23 @@ module PuppetMetadata
|
|
45
47
|
'18.04' => 5..7,
|
46
48
|
'20.04' => 6..7,
|
47
49
|
},
|
48
|
-
}
|
50
|
+
}.freeze
|
49
51
|
|
50
|
-
|
51
|
-
|
52
|
-
|
52
|
+
PUPPET_RUBY_VERSIONS = {
|
53
|
+
4 => '2.1',
|
54
|
+
5 => '2.4',
|
55
|
+
6 => '2.5',
|
56
|
+
7 => '2.7',
|
57
|
+
}.freeze
|
58
|
+
|
59
|
+
class << self
|
60
|
+
def find_base_os(os)
|
61
|
+
COMPATIBLE.fetch(os, os)
|
62
|
+
end
|
53
63
|
|
54
|
-
|
55
|
-
|
64
|
+
def has_aio_build?(os, release, puppet_version)
|
65
|
+
BUILDS.dig(find_base_os(os), release)&.include?(puppet_version)
|
66
|
+
end
|
56
67
|
end
|
57
68
|
end
|
58
69
|
end
|
@@ -4,62 +4,79 @@ module PuppetMetadata
|
|
4
4
|
# @see https://rubygems.org/gems/beaker
|
5
5
|
# @see https://rubygems.org/gems/beaker-hostgenerator
|
6
6
|
class Beaker
|
7
|
-
#
|
8
|
-
#
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
# needed when the daemon uses PIDFile in its service file and using
|
18
|
-
# Docker as a Beaker hypervisor. This is to work around Docker's
|
19
|
-
# limitations.
|
20
|
-
# When a boolean, it's applied on applicable operating systems. On arrays
|
21
|
-
# it's applied only when os is included in the provided array.
|
22
|
-
#
|
23
|
-
# @return [nil] If no setfile is available
|
24
|
-
# @return [Array<(String, String)>] The beaker setfile description with a readable name
|
25
|
-
def self.os_release_to_setfile(os, release, use_fqdn: false, pidfile_workaround: false)
|
26
|
-
return unless os_supported?(os)
|
7
|
+
# These images have an older systemd, which they work with
|
8
|
+
# PIDFile parameter
|
9
|
+
PIDFILE_COMPATIBLE_IMAGES = {
|
10
|
+
'CentOS' => {
|
11
|
+
'7' => 'centos:7.6.1810',
|
12
|
+
},
|
13
|
+
'Ubuntu' => {
|
14
|
+
'16.04' => 'ubuntu:xenial-20191212',
|
15
|
+
},
|
16
|
+
}.freeze
|
27
17
|
|
28
|
-
|
18
|
+
# There is no CentOS 8 image that works with PIDFile in systemd
|
19
|
+
# unit files
|
20
|
+
PIDFILE_INCOMPATIBLE = {
|
21
|
+
'CentOS' => ['8'],
|
22
|
+
}.freeze
|
23
|
+
class << self
|
24
|
+
# Convert an Operating System name with a release to a Beaker setfile
|
25
|
+
#
|
26
|
+
# @param [String] os
|
27
|
+
# The Operating System string as metadata.json knows it, which in turn is
|
28
|
+
# based on Facter's operatingsystem fact.
|
29
|
+
# @param [String] release The OS release
|
30
|
+
# @param [Boolean] use_fqdn
|
31
|
+
# Whether or not to use a FQDN, ensuring a domain
|
32
|
+
# @param [Boolean, Array[String]] pidfile_workaround
|
33
|
+
# Whether or not to apply the systemd PIDFile workaround. This is only
|
34
|
+
# needed when the daemon uses PIDFile in its service file and using
|
35
|
+
# Docker as a Beaker hypervisor. This is to work around Docker's
|
36
|
+
# limitations.
|
37
|
+
# When a boolean, it's applied on applicable operating systems. On arrays
|
38
|
+
# it's applied only when os is included in the provided array.
|
39
|
+
#
|
40
|
+
# @return [nil] If no setfile is available
|
41
|
+
# @return [Array<(String, String)>] The beaker setfile description with a readable name
|
42
|
+
def os_release_to_setfile(os, release, use_fqdn: false, pidfile_workaround: false)
|
43
|
+
return unless os_supported?(os)
|
29
44
|
|
30
|
-
|
31
|
-
options[:hostname] = "#{name}.example.com" if use_fqdn
|
45
|
+
name = "#{os.downcase}#{release.tr('.', '')}-64"
|
32
46
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
when
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
# unit files
|
44
|
-
return
|
47
|
+
options = {}
|
48
|
+
options[:hostname] = "#{name}.example.com" if use_fqdn
|
49
|
+
|
50
|
+
# Docker messes up cgroups and some systemd versions can't deal with
|
51
|
+
# that when PIDFile is used.
|
52
|
+
if pidfile_workaround?(pidfile_workaround, os)
|
53
|
+
return if PIDFILE_INCOMPATIBLE[os]&.include?(release)
|
54
|
+
|
55
|
+
if (image = PIDFILE_COMPATIBLE_IMAGES.dig(os, release))
|
56
|
+
options[:image] = image
|
45
57
|
end
|
46
|
-
when 'Ubuntu'
|
47
|
-
options[:image] = 'ubuntu:xenial-20191212' if release == '16.04'
|
48
58
|
end
|
59
|
+
|
60
|
+
human_name = "#{os} #{release}"
|
61
|
+
|
62
|
+
[build_setfile(name, options), human_name]
|
49
63
|
end
|
50
64
|
|
51
|
-
setfile
|
52
|
-
|
65
|
+
# Return whether a Beaker setfile can be generated for the given OS
|
66
|
+
# @param [String] os The operating system
|
67
|
+
def os_supported?(os)
|
68
|
+
['CentOS', 'Fedora', 'Debian', 'Ubuntu'].include?(os)
|
69
|
+
end
|
53
70
|
|
54
|
-
|
71
|
+
private
|
55
72
|
|
56
|
-
|
57
|
-
|
73
|
+
def pidfile_workaround?(pidfile_workaround, os)
|
74
|
+
pidfile_workaround && (!pidfile_workaround.is_a?(Array) || pidfile_workaround.include?(os))
|
75
|
+
end
|
58
76
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
['CentOS', 'Fedora', 'Debian', 'Ubuntu'].include?(os)
|
77
|
+
def build_setfile(name, options)
|
78
|
+
"#{name}#{options.any? ? "{#{options.map { |key, value| "#{key}=#{value}" }.join(',')}}" : ''}"
|
79
|
+
end
|
63
80
|
end
|
64
81
|
end
|
65
82
|
end
|
@@ -13,7 +13,7 @@ module PuppetMetadata
|
|
13
13
|
beaker_setfiles: beaker_setfiles(beaker_use_fqdn, beaker_pidfile_workaround),
|
14
14
|
puppet_major_versions: puppet_major_versions,
|
15
15
|
puppet_unit_test_matrix: puppet_unit_test_matrix,
|
16
|
-
github_action_test_matrix: github_action_test_matrix,
|
16
|
+
github_action_test_matrix: github_action_test_matrix(use_fqdn: beaker_use_fqdn, pidfile_workaround: beaker_pidfile_workaround),
|
17
17
|
}
|
18
18
|
end
|
19
19
|
|
@@ -42,7 +42,7 @@ module PuppetMetadata
|
|
42
42
|
|
43
43
|
def puppet_unit_test_matrix
|
44
44
|
metadata.puppet_major_versions.sort.reverse.map do |puppet|
|
45
|
-
ruby =
|
45
|
+
ruby = PuppetMetadata::AIO::PUPPET_RUBY_VERSIONS[puppet]
|
46
46
|
next unless ruby
|
47
47
|
|
48
48
|
{
|
@@ -52,24 +52,8 @@ module PuppetMetadata
|
|
52
52
|
end.compact
|
53
53
|
end
|
54
54
|
|
55
|
-
def puppet_ruby_version(puppet_version)
|
56
|
-
case puppet_version
|
57
|
-
when 4
|
58
|
-
'2.1'
|
59
|
-
when 5
|
60
|
-
'2.4'
|
61
|
-
when 6
|
62
|
-
'2.5'
|
63
|
-
when 7
|
64
|
-
'2.7'
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
|
69
55
|
def github_action_test_matrix(use_fqdn: false, pidfile_workaround: false)
|
70
|
-
|
71
|
-
|
72
|
-
metadata.operatingsystems.each do |os, releases|
|
56
|
+
metadata.operatingsystems.each_with_object([]) do |(os, releases), matrix_include|
|
73
57
|
releases&.each do |release|
|
74
58
|
puppet_major_versions.each do |puppet_version|
|
75
59
|
next unless AIO.has_aio_build?(os, release, puppet_version[:value])
|
@@ -87,8 +71,6 @@ module PuppetMetadata
|
|
87
71
|
end
|
88
72
|
end
|
89
73
|
end
|
90
|
-
|
91
|
-
matrix_include
|
92
74
|
end
|
93
75
|
end
|
94
76
|
end
|
@@ -11,7 +11,8 @@ module PuppetMetadata
|
|
11
11
|
EOL_DATES = {
|
12
12
|
# https://endoflife.software/operating-systems/linux/centos
|
13
13
|
'CentOS' => {
|
14
|
-
'
|
14
|
+
'9' => nil, # EOL Date is not yet announced.
|
15
|
+
'8' => '2024-05-31',
|
15
16
|
'7' => '2024-06-30',
|
16
17
|
'6' => '2020-11-30',
|
17
18
|
'5' => '2017-03-31',
|
@@ -22,9 +23,10 @@ module PuppetMetadata
|
|
22
23
|
# https://wiki.debian.org/DebianReleases
|
23
24
|
'Debian' => {
|
24
25
|
# TODO: EOL is standard support, not the extended life cycle
|
26
|
+
'11' => nil, # '~2024',
|
25
27
|
'10' => nil, # '~2022',
|
26
|
-
'9' =>
|
27
|
-
'8' => '2018-06-
|
28
|
+
'9' => '2020-07-06',
|
29
|
+
'8' => '2018-06-17',
|
28
30
|
'7' => '2016-04-26',
|
29
31
|
'6' => '2015-05-31',
|
30
32
|
'5' => '2012-02-06',
|
@@ -113,47 +115,49 @@ module PuppetMetadata
|
|
113
115
|
'5.04' => '2006-10-31',
|
114
116
|
'4.10' => '2006-04-30',
|
115
117
|
},
|
116
|
-
}
|
118
|
+
}.freeze
|
117
119
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
120
|
+
class << self
|
121
|
+
# Return the EOL date for the given operating system release
|
122
|
+
# @param [String] operatingsystem
|
123
|
+
# The operating system
|
124
|
+
# @param [String] release
|
125
|
+
# The major version of the operating system
|
126
|
+
# @return [optional, Date]
|
127
|
+
# The EOL date for the given operating system release. Nil is returned
|
128
|
+
# when the either when the OS, the release or the EOL date is unknown
|
129
|
+
def eol_date(operatingsystem, release)
|
130
|
+
releases = EOL_DATES[operatingsystem]
|
131
|
+
return unless releases
|
132
|
+
date = releases[release]
|
133
|
+
return unless date
|
134
|
+
Date.parse(date)
|
135
|
+
end
|
133
136
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
137
|
+
# Return whether the given operating system release is EOL at the given
|
138
|
+
# date
|
139
|
+
#
|
140
|
+
# @param [String] operatingsystem
|
141
|
+
# The operating system
|
142
|
+
# @param [String] release
|
143
|
+
# The major version of the operating system
|
144
|
+
# @return [Boolean]
|
145
|
+
# The EOL date for the given operating system release. Nil is returned
|
146
|
+
# when the either when the OS, the release or the EOL date is unknown
|
147
|
+
def eol?(operatingsystem, release, at = nil)
|
148
|
+
date = eol_date(operatingsystem, release)
|
149
|
+
date && date < (at || Date.today)
|
150
|
+
end
|
148
151
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
152
|
+
# Return the latest known release for a given operating system
|
153
|
+
# @param [String] operatingsystem The operating system
|
154
|
+
# @return [optional, String]
|
155
|
+
# The latest major release for the given operating system, if any is
|
156
|
+
# known
|
157
|
+
def latest_release(operatingsystem)
|
158
|
+
releases = EOL_DATES[operatingsystem]
|
159
|
+
releases&.keys&.max_by { |release| Gem::Version.new(release) }
|
160
|
+
end
|
157
161
|
end
|
158
162
|
end
|
159
163
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet_metadata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vox Pupuli
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-02-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: metadata-json-lint
|
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
- !ruby/object:Gem::Version
|
154
154
|
version: '0'
|
155
155
|
requirements: []
|
156
|
-
rubygems_version: 3.2.
|
156
|
+
rubygems_version: 3.2.32
|
157
157
|
signing_key:
|
158
158
|
specification_version: 4
|
159
159
|
summary: Data structures for the Puppet Metadata
|