puppet_metadata 5.3.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +168 -33
- data/bin/metadata2gha +0 -15
- data/bin/puppet-metadata +64 -0
- data/bin/setfiles +2 -1
- data/bin/update_eol_dates +267 -0
- data/data/eol_dates.json +292 -0
- data/lib/puppet_metadata/aio.rb +4 -1
- data/lib/puppet_metadata/base_command.rb +50 -0
- data/lib/puppet_metadata/beaker.rb +5 -44
- data/lib/puppet_metadata/command/os_versions.rb +121 -0
- data/lib/puppet_metadata/command/setfiles.rb +23 -0
- data/lib/puppet_metadata/command.rb +18 -0
- data/lib/puppet_metadata/github_actions.rb +0 -1
- data/lib/puppet_metadata/metadata.rb +73 -0
- data/lib/puppet_metadata/operatingsystem.rb +53 -207
- data/lib/puppet_metadata.rb +9 -0
- metadata +23 -8
data/data/eol_dates.json
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
{
|
|
2
|
+
"AlmaLinux": {
|
|
3
|
+
"10": "2035-05-31",
|
|
4
|
+
"9": "2032-05-31",
|
|
5
|
+
"8": "2029-03-01"
|
|
6
|
+
},
|
|
7
|
+
"Amazon": {
|
|
8
|
+
"2023": "2029-06-30",
|
|
9
|
+
"2.0": "2026-06-30",
|
|
10
|
+
"2010.11": "2023-12-31",
|
|
11
|
+
"2011.09": "2023-12-31",
|
|
12
|
+
"2012.03": "2023-12-31",
|
|
13
|
+
"2012.09": "2023-12-31",
|
|
14
|
+
"2013.03": "2023-12-31",
|
|
15
|
+
"2013.09": "2023-12-31",
|
|
16
|
+
"2014.03": "2023-12-31",
|
|
17
|
+
"2014.09": "2023-12-31",
|
|
18
|
+
"2015.03": "2023-12-31",
|
|
19
|
+
"2015.09": "2023-12-31",
|
|
20
|
+
"2016.03": "2023-12-31",
|
|
21
|
+
"2016.09": "2023-12-31",
|
|
22
|
+
"2017.03": "2023-12-31",
|
|
23
|
+
"2017.09": "2023-12-31",
|
|
24
|
+
"2018.03": "2023-12-31"
|
|
25
|
+
},
|
|
26
|
+
"CentOS": {
|
|
27
|
+
"10": "2030-01-01",
|
|
28
|
+
"9": "2027-05-31",
|
|
29
|
+
"7": "2024-06-30",
|
|
30
|
+
"8": "2021-12-31",
|
|
31
|
+
"6": "2020-11-30",
|
|
32
|
+
"5": "2017-03-31",
|
|
33
|
+
"4": "2012-02-29",
|
|
34
|
+
"3": "2010-10-30"
|
|
35
|
+
},
|
|
36
|
+
"Debian": {
|
|
37
|
+
"13": "2030-06-30",
|
|
38
|
+
"12": "2028-06-30",
|
|
39
|
+
"11": "2026-08-31",
|
|
40
|
+
"10": "2024-06-30",
|
|
41
|
+
"9": "2022-07-01",
|
|
42
|
+
"8": "2020-06-30",
|
|
43
|
+
"7": "2018-05-31",
|
|
44
|
+
"6": "2016-02-29",
|
|
45
|
+
"5": "2012-02-06",
|
|
46
|
+
"4": "2010-02-15",
|
|
47
|
+
"3.1": "2008-03-31",
|
|
48
|
+
"3.0": "2006-06-30",
|
|
49
|
+
"2.2": "2003-06-30",
|
|
50
|
+
"2.1": "2000-09-30",
|
|
51
|
+
"2.0": "1999-02-15",
|
|
52
|
+
"1.3": "1998-12-08",
|
|
53
|
+
"1.2": "1997-10-23",
|
|
54
|
+
"1.1": "1996-12-12"
|
|
55
|
+
},
|
|
56
|
+
"OracleLinux": {
|
|
57
|
+
"10": null,
|
|
58
|
+
"9": "2032-06-30",
|
|
59
|
+
"8": "2029-07-31",
|
|
60
|
+
"7": "2024-12-31",
|
|
61
|
+
"6": "2021-03-31"
|
|
62
|
+
},
|
|
63
|
+
"Fedora": {
|
|
64
|
+
"43": "2026-12-09",
|
|
65
|
+
"42": "2026-05-13",
|
|
66
|
+
"41": "2025-11-26",
|
|
67
|
+
"40": "2025-05-13",
|
|
68
|
+
"39": "2024-11-26",
|
|
69
|
+
"38": "2024-05-21",
|
|
70
|
+
"37": "2023-12-05",
|
|
71
|
+
"36": "2023-05-16",
|
|
72
|
+
"35": "2022-12-13",
|
|
73
|
+
"34": "2022-06-07",
|
|
74
|
+
"33": "2021-11-30",
|
|
75
|
+
"32": "2021-05-25",
|
|
76
|
+
"31": "2020-11-24",
|
|
77
|
+
"30": "2020-05-26",
|
|
78
|
+
"29": "2019-11-26",
|
|
79
|
+
"28": "2019-05-28",
|
|
80
|
+
"27": "2018-11-30",
|
|
81
|
+
"26": "2018-05-29",
|
|
82
|
+
"25": "2017-12-12",
|
|
83
|
+
"24": "2017-08-08",
|
|
84
|
+
"23": "2016-12-20",
|
|
85
|
+
"22": "2016-07-19",
|
|
86
|
+
"21": "2015-12-01",
|
|
87
|
+
"20": "2015-06-23",
|
|
88
|
+
"19": "2015-01-06",
|
|
89
|
+
"18": "2014-01-14",
|
|
90
|
+
"17": "2013-07-30",
|
|
91
|
+
"16": "2013-02-12",
|
|
92
|
+
"15": "2012-06-26",
|
|
93
|
+
"14": "2011-12-09",
|
|
94
|
+
"13": "2011-06-24",
|
|
95
|
+
"12": "2010-12-02",
|
|
96
|
+
"11": "2010-06-25",
|
|
97
|
+
"10": "2009-12-17",
|
|
98
|
+
"9": "2009-07-10",
|
|
99
|
+
"8": "2009-01-07",
|
|
100
|
+
"7": "2008-06-13",
|
|
101
|
+
"6": "2007-12-07",
|
|
102
|
+
"5": "2007-07-02",
|
|
103
|
+
"4": "2006-08-07",
|
|
104
|
+
"3": "2006-01-16",
|
|
105
|
+
"2": "2005-04-11",
|
|
106
|
+
"1": "2004-09-20"
|
|
107
|
+
},
|
|
108
|
+
"FreeBSD": {
|
|
109
|
+
"14": "2028-11-30",
|
|
110
|
+
"14.3": "2026-06-30",
|
|
111
|
+
"13": "2026-04-30",
|
|
112
|
+
"13.5": "2026-04-30",
|
|
113
|
+
"14.2": "2025-09-30",
|
|
114
|
+
"13.4": "2025-06-30",
|
|
115
|
+
"14.1": "2025-03-31",
|
|
116
|
+
"13.3": "2024-12-31",
|
|
117
|
+
"14.0": "2024-09-30",
|
|
118
|
+
"13.2": "2024-06-30",
|
|
119
|
+
"12": "2023-12-31",
|
|
120
|
+
"12.4": "2023-12-31",
|
|
121
|
+
"13.1": "2023-07-31",
|
|
122
|
+
"12.3": "2023-03-31",
|
|
123
|
+
"13.0": "2022-08-31",
|
|
124
|
+
"12.2": "2022-03-31",
|
|
125
|
+
"11": "2021-09-30",
|
|
126
|
+
"11.4": "2021-09-30",
|
|
127
|
+
"12.1": "2021-01-31",
|
|
128
|
+
"11.3": "2020-09-30",
|
|
129
|
+
"12.0": "2020-02-29",
|
|
130
|
+
"11.2": "2019-10-31",
|
|
131
|
+
"10": "2018-10-31",
|
|
132
|
+
"10.4": "2018-10-31",
|
|
133
|
+
"11.1": "2018-09-30",
|
|
134
|
+
"10.3": "2018-04-30",
|
|
135
|
+
"11.0": "2017-11-30",
|
|
136
|
+
"9": "2016-12-31",
|
|
137
|
+
"9.3": "2016-12-31",
|
|
138
|
+
"10.1": "2016-12-31",
|
|
139
|
+
"10.2": "2016-12-31",
|
|
140
|
+
"8": "2015-08-01",
|
|
141
|
+
"8.4": "2015-08-01",
|
|
142
|
+
"10.0": "2015-02-28",
|
|
143
|
+
"9.1": "2014-12-31",
|
|
144
|
+
"9.2": "2014-12-31",
|
|
145
|
+
"8.3": "2014-04-30",
|
|
146
|
+
"9.0": "2013-03-31",
|
|
147
|
+
"7": "2013-02-28",
|
|
148
|
+
"7.4": "2013-02-28",
|
|
149
|
+
"8.1": "2012-07-31",
|
|
150
|
+
"8.2": "2012-07-31",
|
|
151
|
+
"7.3": "2012-03-31",
|
|
152
|
+
"7.1": "2011-02-28",
|
|
153
|
+
"6": "2010-11-30",
|
|
154
|
+
"6.4": "2010-11-30",
|
|
155
|
+
"8.0": "2010-11-30",
|
|
156
|
+
"7.2": "2010-06-30",
|
|
157
|
+
"6.3": "2010-01-31",
|
|
158
|
+
"7.0": "2009-04-30",
|
|
159
|
+
"5": "2008-05-31",
|
|
160
|
+
"6.1": "2008-05-31",
|
|
161
|
+
"5.5": "2008-05-31",
|
|
162
|
+
"6.2": "2008-05-31",
|
|
163
|
+
"4": "2007-01-31",
|
|
164
|
+
"4.10": "2007-01-31",
|
|
165
|
+
"4.11": "2007-01-31",
|
|
166
|
+
"6.0": "2007-01-31",
|
|
167
|
+
"5.3": "2006-10-31",
|
|
168
|
+
"5.4": "2006-10-31",
|
|
169
|
+
"5.2": "2005-02-28",
|
|
170
|
+
"4.9": "2004-08-31",
|
|
171
|
+
"5.1": "2004-04-30",
|
|
172
|
+
"4.8": "2004-02-28",
|
|
173
|
+
"5.0": "2003-09-30",
|
|
174
|
+
"4.7": "2003-07-31",
|
|
175
|
+
"4.6": "2003-01-31",
|
|
176
|
+
"4.5": "2002-09-30",
|
|
177
|
+
"4.4": "2002-04-30",
|
|
178
|
+
"4.3": "2001-12-31",
|
|
179
|
+
"4.2": "2001-07-31",
|
|
180
|
+
"3.5": "2001-06-30",
|
|
181
|
+
"4.1": "2001-02-28",
|
|
182
|
+
"4.0": "2000-10-31",
|
|
183
|
+
"3.4": "2000-09-30",
|
|
184
|
+
"3.3": "2000-02-29",
|
|
185
|
+
"3.2": "1999-12-31",
|
|
186
|
+
"3.1": "1999-08-31",
|
|
187
|
+
"3.0": "1999-05-31",
|
|
188
|
+
"2.2": "1998-03-31",
|
|
189
|
+
"2.1": "1997-06-30",
|
|
190
|
+
"2.0": "1996-02-28",
|
|
191
|
+
"1.1": "1995-05-31",
|
|
192
|
+
"1.0": "1994-08-31"
|
|
193
|
+
},
|
|
194
|
+
"RedHat": {
|
|
195
|
+
"10": "2035-05-31",
|
|
196
|
+
"9": "2032-05-31",
|
|
197
|
+
"8": "2029-05-31",
|
|
198
|
+
"7": "2024-06-30",
|
|
199
|
+
"6": "2020-11-30",
|
|
200
|
+
"5": "2017-03-31",
|
|
201
|
+
"4": "2012-02-29",
|
|
202
|
+
"3": "2010-10-31"
|
|
203
|
+
},
|
|
204
|
+
"Rocky": {
|
|
205
|
+
"10": "2035-05-31",
|
|
206
|
+
"9": "2032-05-31",
|
|
207
|
+
"8": "2029-05-31"
|
|
208
|
+
},
|
|
209
|
+
"Scientific": {
|
|
210
|
+
"7": "2024-06-30",
|
|
211
|
+
"8": "2024-06-30",
|
|
212
|
+
"6": "2020-11-30",
|
|
213
|
+
"5": "2017-03-31",
|
|
214
|
+
"4": "2012-02-29",
|
|
215
|
+
"3": "2010-10-30"
|
|
216
|
+
},
|
|
217
|
+
"SLES": {
|
|
218
|
+
"15": "2031-07-31",
|
|
219
|
+
"15.7": "2031-07-31",
|
|
220
|
+
"15.6": "2025-12-31",
|
|
221
|
+
"15.5": "2024-12-31",
|
|
222
|
+
"12": "2024-10-31",
|
|
223
|
+
"12.5": "2024-10-31",
|
|
224
|
+
"15.4": "2023-12-31",
|
|
225
|
+
"15.3": "2022-12-31",
|
|
226
|
+
"15.2": "2021-12-31",
|
|
227
|
+
"15.1": "2021-01-31",
|
|
228
|
+
"12.4": "2020-06-30",
|
|
229
|
+
"15.0": "2019-12-31",
|
|
230
|
+
"12.3": "2019-06-30",
|
|
231
|
+
"11": "2019-03-31",
|
|
232
|
+
"11.4": "2019-03-31",
|
|
233
|
+
"12.2": "2018-03-31",
|
|
234
|
+
"12.1": "2017-05-31",
|
|
235
|
+
"12.0": "2016-06-30",
|
|
236
|
+
"11.3": "2016-01-31",
|
|
237
|
+
"11.2": "2014-01-31",
|
|
238
|
+
"10": "2013-07-31",
|
|
239
|
+
"10.4": "2013-07-31",
|
|
240
|
+
"11.1": "2012-08-31",
|
|
241
|
+
"10.3": "2011-10-11",
|
|
242
|
+
"11.0": "2010-12-31",
|
|
243
|
+
"10.2": "2010-04-11",
|
|
244
|
+
"10.1": "2008-11-30",
|
|
245
|
+
"10.0": "2007-12-31"
|
|
246
|
+
},
|
|
247
|
+
"Ubuntu": {
|
|
248
|
+
"24.04": "2029-04-25",
|
|
249
|
+
"22.04": "2027-04-01",
|
|
250
|
+
"25.10": "2026-07-01",
|
|
251
|
+
"25.04": "2026-01-17",
|
|
252
|
+
"24.10": "2025-07-10",
|
|
253
|
+
"20.04": "2025-05-31",
|
|
254
|
+
"23.10": "2024-07-12",
|
|
255
|
+
"23.04": "2024-01-20",
|
|
256
|
+
"22.10": "2023-07-20",
|
|
257
|
+
"18.04": "2023-05-31",
|
|
258
|
+
"21.10": "2022-07-14",
|
|
259
|
+
"21.04": "2022-01-20",
|
|
260
|
+
"20.10": "2021-07-22",
|
|
261
|
+
"16.04": "2021-04-02",
|
|
262
|
+
"19.10": "2020-07-06",
|
|
263
|
+
"19.04": "2020-01-23",
|
|
264
|
+
"18.10": "2019-07-18",
|
|
265
|
+
"14.04": "2019-04-02",
|
|
266
|
+
"17.10": "2018-07-19",
|
|
267
|
+
"17.04": "2018-01-13",
|
|
268
|
+
"16.10": "2017-07-20",
|
|
269
|
+
"12.04": "2017-04-28",
|
|
270
|
+
"15.10": "2016-07-28",
|
|
271
|
+
"15.04": "2016-02-04",
|
|
272
|
+
"14.10": "2015-07-23",
|
|
273
|
+
"13.10": "2014-07-17",
|
|
274
|
+
"12.10": "2014-05-16",
|
|
275
|
+
"13.04": "2014-01-27",
|
|
276
|
+
"8.04": "2013-05-09",
|
|
277
|
+
"10.04": "2013-05-09",
|
|
278
|
+
"11.10": "2013-05-09",
|
|
279
|
+
"11.04": "2012-10-28",
|
|
280
|
+
"10.10": "2012-04-10",
|
|
281
|
+
"6.06": "2011-06-01",
|
|
282
|
+
"9.10": "2011-04-30",
|
|
283
|
+
"9.04": "2010-10-23",
|
|
284
|
+
"8.10": "2010-04-30",
|
|
285
|
+
"7.10": "2009-04-18",
|
|
286
|
+
"7.04": "2008-10-19",
|
|
287
|
+
"6.10": "2008-04-26",
|
|
288
|
+
"5.10": "2007-04-13",
|
|
289
|
+
"5.04": "2006-10-31",
|
|
290
|
+
"4.10": "2006-04-30"
|
|
291
|
+
}
|
|
292
|
+
}
|
data/lib/puppet_metadata/aio.rb
CHANGED
|
@@ -2,7 +2,6 @@ module PuppetMetadata
|
|
|
2
2
|
class AIO
|
|
3
3
|
COMPATIBLE = {
|
|
4
4
|
'AlmaLinux' => 'RedHat',
|
|
5
|
-
'Amazon' => 'RedHat',
|
|
6
5
|
'CentOS' => 'RedHat',
|
|
7
6
|
'OracleLinux' => 'RedHat',
|
|
8
7
|
'Rocky' => 'RedHat',
|
|
@@ -38,6 +37,10 @@ module PuppetMetadata
|
|
|
38
37
|
}.freeze
|
|
39
38
|
|
|
40
39
|
OPENVOX_BUILDS = PUPPET_BUILDS.merge({
|
|
40
|
+
# RPM-based
|
|
41
|
+
'Amazon' => {
|
|
42
|
+
'2023' => [8],
|
|
43
|
+
},
|
|
41
44
|
'RedHat' => {
|
|
42
45
|
'7' => 7..8,
|
|
43
46
|
'8' => 7..8,
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PuppetMetadata
|
|
4
|
+
# The base command. All actual commands should inherit from this.
|
|
5
|
+
class BaseCommand
|
|
6
|
+
def initialize(arguments, options)
|
|
7
|
+
@arguments = arguments
|
|
8
|
+
@options = options
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def filename
|
|
12
|
+
@filename ||= @options.fetch(:filename, 'metadata.json')
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def metadata
|
|
16
|
+
@metadata ||= PuppetMetadata.read(filename)
|
|
17
|
+
rescue StandardError => e
|
|
18
|
+
warn "Failed to read #{filename}: #{e}"
|
|
19
|
+
exit 2
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def self.commands
|
|
23
|
+
PuppetMetadata::Command.load_commands
|
|
24
|
+
|
|
25
|
+
subclasses.to_h { |subclass| [subclass.command, subclass] }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def self.command
|
|
29
|
+
name.gsub(/Command$/, '')
|
|
30
|
+
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
|
31
|
+
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
|
32
|
+
.tr('_', '-')
|
|
33
|
+
.downcase
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Return a parser. The program name should be overridden with a description
|
|
37
|
+
# @param [Hash] _options
|
|
38
|
+
# The data to store the options into
|
|
39
|
+
# @return [OptionParser]
|
|
40
|
+
# The parser for the command
|
|
41
|
+
def self.parser(_options)
|
|
42
|
+
raise NotImplementedError
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Actual implementation of the command
|
|
46
|
+
def run
|
|
47
|
+
raise NotImplementedError
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -4,25 +4,6 @@ module PuppetMetadata
|
|
|
4
4
|
# @see https://rubygems.org/gems/beaker
|
|
5
5
|
# @see https://rubygems.org/gems/beaker-hostgenerator
|
|
6
6
|
class Beaker
|
|
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
|
|
17
|
-
|
|
18
|
-
# There is no CentOS 8 image that works with PIDFile in systemd
|
|
19
|
-
# unit files
|
|
20
|
-
PIDFILE_INCOMPATIBLE = {
|
|
21
|
-
'CentOS' => ['8'],
|
|
22
|
-
'AlmaLinux' => ['8'],
|
|
23
|
-
'OracleLinux' => ['7', '8'],
|
|
24
|
-
'Rocky' => ['8'],
|
|
25
|
-
}.freeze
|
|
26
7
|
class << self
|
|
27
8
|
# modifies the operating system name to suit beaker-hostgenerator
|
|
28
9
|
# @param [String] os
|
|
@@ -31,6 +12,8 @@ module PuppetMetadata
|
|
|
31
12
|
case os
|
|
32
13
|
when 'OracleLinux'
|
|
33
14
|
'oracle'
|
|
15
|
+
when 'Amazonlinux', 'AmazonLinux' # Vox Pupuli default is Amazon in metadata.json
|
|
16
|
+
'amazon'
|
|
34
17
|
else
|
|
35
18
|
os.downcase
|
|
36
19
|
end
|
|
@@ -42,13 +25,6 @@ module PuppetMetadata
|
|
|
42
25
|
# The Operating System string as metadata.json knows it, which in turn is
|
|
43
26
|
# based on Facter's operatingsystem fact.
|
|
44
27
|
# @param [String] release The OS release
|
|
45
|
-
# @param [Boolean, Array[String]] pidfile_workaround
|
|
46
|
-
# Whether or not to apply the systemd PIDFile workaround. This is only
|
|
47
|
-
# needed when the daemon uses PIDFile in its service file and using
|
|
48
|
-
# Docker as a Beaker hypervisor. This is to work around Docker's
|
|
49
|
-
# limitations.
|
|
50
|
-
# When a boolean, it's applied on applicable operating systems. On arrays
|
|
51
|
-
# it's applied only when os is included in the provided array.
|
|
52
28
|
# @param [Optional[String]] domain
|
|
53
29
|
# Enforce a domain to be appended to the hostname, making it an FQDN
|
|
54
30
|
# @param [Optional[String]] puppet_version
|
|
@@ -61,7 +37,7 @@ module PuppetMetadata
|
|
|
61
37
|
#
|
|
62
38
|
# @return [nil] If no setfile is available
|
|
63
39
|
# @return [Array<(String, String)>] The beaker setfile description with a readable name
|
|
64
|
-
def os_release_to_setfile(os, release,
|
|
40
|
+
def os_release_to_setfile(os, release, domain: nil, puppet_version: nil, hosts: nil)
|
|
65
41
|
return unless os_supported?(os)
|
|
66
42
|
|
|
67
43
|
aos = adjusted_os(os)
|
|
@@ -96,21 +72,10 @@ module PuppetMetadata
|
|
|
96
72
|
end
|
|
97
73
|
|
|
98
74
|
options = {}
|
|
99
|
-
# Docker messes up cgroups and some systemd versions can't deal with
|
|
100
|
-
# that when PIDFile is used.
|
|
101
|
-
image_to_use = nil
|
|
102
|
-
if pidfile_workaround?(pidfile_workaround, os)
|
|
103
|
-
return if PIDFILE_INCOMPATIBLE[os]&.include?(release)
|
|
104
|
-
|
|
105
|
-
if (image = PIDFILE_COMPATIBLE_IMAGES.dig(os, release))
|
|
106
|
-
image_to_use = image
|
|
107
|
-
end
|
|
108
|
-
end
|
|
109
75
|
|
|
110
76
|
setfile_parts = []
|
|
111
77
|
hosts_settings.each do |host_settings|
|
|
112
78
|
options[:hostname] = host_settings['hostname'] unless host_settings['hostname'].empty?
|
|
113
|
-
options[:image] = image_to_use if image_to_use
|
|
114
79
|
setfile_parts << build_setfile(host_settings['name'], options)
|
|
115
80
|
end
|
|
116
81
|
|
|
@@ -120,17 +85,13 @@ module PuppetMetadata
|
|
|
120
85
|
# Return whether a Beaker setfile can be generated for the given OS
|
|
121
86
|
# @param [String] os The operating system
|
|
122
87
|
def os_supported?(os)
|
|
123
|
-
%w[Archlinux CentOS Fedora Debian Ubuntu Rocky AlmaLinux OracleLinux].include?(os)
|
|
88
|
+
%w[Amazonlinux Amazon Archlinux CentOS Fedora Debian Ubuntu Rocky AlmaLinux OracleLinux].include?(os)
|
|
124
89
|
end
|
|
125
90
|
|
|
126
91
|
private
|
|
127
92
|
|
|
128
|
-
def pidfile_workaround?(pidfile_workaround, os)
|
|
129
|
-
pidfile_workaround && (!pidfile_workaround.is_a?(Array) || pidfile_workaround.include?(os))
|
|
130
|
-
end
|
|
131
|
-
|
|
132
93
|
def build_setfile(name, options)
|
|
133
|
-
"#{name}#{
|
|
94
|
+
"#{name}#{"{#{options.map { |key, value| "#{key}=#{value}" }.join(',')}}" if options.any?}"
|
|
134
95
|
end
|
|
135
96
|
end
|
|
136
97
|
end
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Manage operating system versions in metadata.json
|
|
4
|
+
class OsVersionsCommand < PuppetMetadata::BaseCommand
|
|
5
|
+
def self.parser(options)
|
|
6
|
+
OptionParser.new do |opts|
|
|
7
|
+
opts.set_program_name 'Manage operating system versions in metadata.json'
|
|
8
|
+
opts.on('--at DATE', Date, 'The date to use for EOL checks') do |value|
|
|
9
|
+
options[:at] = value
|
|
10
|
+
end
|
|
11
|
+
opts.on('--os OPERATINGSYSTEM', 'Only process the specific operating system') do |value|
|
|
12
|
+
options[:os] = value
|
|
13
|
+
end
|
|
14
|
+
opts.on('--add-missing', 'Add missing supported OS versions to metadata.json') do
|
|
15
|
+
options[:add_missing] = true
|
|
16
|
+
end
|
|
17
|
+
opts.on('--remove-eol', 'Remove EOL OS versions from metadata.json') do
|
|
18
|
+
options[:remove_eol] = true
|
|
19
|
+
end
|
|
20
|
+
opts.on('--noop', 'Show what would be changed without modifying metadata.json') do
|
|
21
|
+
options[:noop] = true
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def run
|
|
27
|
+
changes_made = false
|
|
28
|
+
|
|
29
|
+
if @options[:add_missing] && @options[:remove_eol]
|
|
30
|
+
# Run both operations in sequence
|
|
31
|
+
changes_made |= add_missing
|
|
32
|
+
changes_made |= remove_eol
|
|
33
|
+
elsif @options[:add_missing]
|
|
34
|
+
changes_made = add_missing
|
|
35
|
+
elsif @options[:remove_eol]
|
|
36
|
+
changes_made = remove_eol
|
|
37
|
+
else
|
|
38
|
+
list_versions
|
|
39
|
+
return
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
PuppetMetadata.write(filename, metadata) if changes_made && !@options[:noop]
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
private
|
|
46
|
+
|
|
47
|
+
# rubocop:disable Naming/PredicateMethod
|
|
48
|
+
def add_missing
|
|
49
|
+
added = metadata.add_supported_operatingsystems(@options[:at], @options[:os])
|
|
50
|
+
|
|
51
|
+
return false unless added.any?
|
|
52
|
+
|
|
53
|
+
prefix = @options[:noop] ? '[NOOP] Would add support:' : 'Added support:'
|
|
54
|
+
puts prefix
|
|
55
|
+
added.each do |os, releases|
|
|
56
|
+
puts "#{os} => #{releases.join(', ')}"
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
true
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def remove_eol
|
|
63
|
+
removed = metadata.remove_eol_operatingsystems(@options[:at], @options[:os])
|
|
64
|
+
|
|
65
|
+
return false unless removed.any?
|
|
66
|
+
|
|
67
|
+
prefix = @options[:noop] ? '[NOOP] Would remove EOL operating systems:' : 'Removed EOL operating systems:'
|
|
68
|
+
puts prefix
|
|
69
|
+
removed.each do |os, releases|
|
|
70
|
+
puts "#{os} => #{releases.join(', ')}"
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Check for OSes that now have empty version lists
|
|
74
|
+
metadata.operatingsystems.each do |os, versions|
|
|
75
|
+
warn "Warning: #{os} has no supported versions after removing EOL releases. Consider removing it from metadata.json or adding newer versions." if versions.is_a?(Array) && versions.empty?
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
true
|
|
79
|
+
end
|
|
80
|
+
# rubocop:enable Naming/PredicateMethod
|
|
81
|
+
|
|
82
|
+
def list_versions
|
|
83
|
+
# Collect all OS data
|
|
84
|
+
supported_oses = {}
|
|
85
|
+
eol_oses = {}
|
|
86
|
+
|
|
87
|
+
oses = @options[:os] ? [@options[:os]] : metadata.operatingsystems.keys.sort
|
|
88
|
+
|
|
89
|
+
oses.each do |os|
|
|
90
|
+
current = metadata.operatingsystems[os]
|
|
91
|
+
|
|
92
|
+
if current.nil? || current.empty?
|
|
93
|
+
supported_oses[os] = '(supports all versions)'
|
|
94
|
+
else
|
|
95
|
+
eol = current.select { |rel| PuppetMetadata::OperatingSystem.eol?(os, rel, @options[:at]) }
|
|
96
|
+
non_eol = current - eol
|
|
97
|
+
|
|
98
|
+
supported_oses[os] = non_eol.join(', ') if non_eol.any?
|
|
99
|
+
eol_oses[os] = eol.join(', ') if eol.any?
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Display supported OSes
|
|
104
|
+
if supported_oses.any?
|
|
105
|
+
puts "#{metadata.name} supports these non-EOL operating system versions:"
|
|
106
|
+
supported_oses.each do |os, versions|
|
|
107
|
+
puts " #{os}: #{versions}"
|
|
108
|
+
end
|
|
109
|
+
puts ''
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# Display EOL OSes
|
|
113
|
+
return unless eol_oses.any?
|
|
114
|
+
|
|
115
|
+
puts "#{metadata.name} supports these EOL operating system versions:"
|
|
116
|
+
eol_oses.each do |os, versions|
|
|
117
|
+
puts " #{os}: #{versions}"
|
|
118
|
+
end
|
|
119
|
+
puts ''
|
|
120
|
+
end
|
|
121
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Show the various setfiles supported by the metadata
|
|
4
|
+
class SetfilesCommand < PuppetMetadata::BaseCommand
|
|
5
|
+
def self.parser(_options)
|
|
6
|
+
OptionParser.new do |opts|
|
|
7
|
+
opts.set_program_name 'Show the various setfiles supported by the metadata'
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def run
|
|
12
|
+
options = {
|
|
13
|
+
domain: 'example.com',
|
|
14
|
+
minimum_major_puppet_version: nil,
|
|
15
|
+
beaker_fact: nil,
|
|
16
|
+
beaker_hosts: nil,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
metadata.github_actions(options).outputs[:puppet_beaker_test_matrix].each do |os|
|
|
20
|
+
puts "BEAKER_SETFILE=\"#{os[:env]['BEAKER_SETFILE']}\""
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PuppetMetadata
|
|
4
|
+
# A collection of commands implemented in the CLI.
|
|
5
|
+
#
|
|
6
|
+
# @see PuppetMetadata::BaseCommand
|
|
7
|
+
module Command
|
|
8
|
+
def self.load_commands
|
|
9
|
+
return if @loaded
|
|
10
|
+
|
|
11
|
+
Dir.glob(File.join(__dir__, 'command', '*.rb')) do |path|
|
|
12
|
+
require_relative File.join('command', File.basename(path, '.rb'))
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
@loaded = true
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -138,7 +138,6 @@ module PuppetMetadata
|
|
|
138
138
|
PuppetMetadata::Beaker.os_release_to_setfile(
|
|
139
139
|
os,
|
|
140
140
|
release,
|
|
141
|
-
pidfile_workaround: options[:beaker_pidfile_workaround],
|
|
142
141
|
domain: options[:domain],
|
|
143
142
|
puppet_version: puppet_collection,
|
|
144
143
|
hosts: options[:beaker_hosts],
|