puppet_metadata 3.4.0 → 3.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 556224029dca3954a88bc2965c547e73976f2dfcff434ec8c4404b116c73ac8b
4
- data.tar.gz: 6f6101c35a3d4bad3a4f575dac4de02788dd454bec93a2a7a6d3328d8f576402
3
+ metadata.gz: 5aafd856a39efeb605c0a8569b500301c0c7205716e2fe66f0baba72625b7247
4
+ data.tar.gz: 6808ed021bb4f5dc80fb2bdb8a31de09824c06e4fccb9ca8b697d25144cbdc8f
5
5
  SHA512:
6
- metadata.gz: c54f5c54e35607a332ed08006c387511b089066f2b9f330a1feb89ee691cb1b4aa062f7246eb5f025a3125a7ce36122ac8fbe7f1c394e757bb2d736957dda558
7
- data.tar.gz: 9b114a9fb73bfe479a0ea425565c3b2bf98228a756a281caadb6ea262fffd1e746dfe706cac85cd6f06e4191812aa4e98e1b975209113495cb8fff146d7d47b6
6
+ metadata.gz: a1b43e47df906018f2712fc079c294ab69fa2e83be38d135ab54dd638345c111d5a60c17493fb4f76649b7da1502d3af992f39b33ed029ce9d47ae6e8ef60918
7
+ data.tar.gz: 16665d3837d3655898fcd475095cec53b69fe84488fa3c2601fd23d0319ce5f996bfed8670dcd47e3974a2b1aaadfdbadc65625c263632312885492e5481f27e
data/README.md CHANGED
@@ -105,6 +105,41 @@ This results in the following JSON data
105
105
 
106
106
  It is also possible to specify a comma separated list of operating systems as used in `metadata.json` (`CentOS,Ubuntu`).
107
107
 
108
+ ## Work with the API
109
+
110
+ The API can be initialised like this:
111
+
112
+ ```ruby
113
+ require 'puppet_metadata'
114
+ metadata = PuppetMetadata.read('/path/to/a/metadata.json')
115
+ ```
116
+
117
+ The metadata object has several different methods that we can call
118
+
119
+ ### List all supported operating systems
120
+
121
+ ```
122
+ [9] pry(main)> metadata.operatingsystems
123
+ => {"Archlinux"=>nil, "Gentoo"=>nil, "Fedora"=>["32", "33"], "CentOS"=>["7", "8"], "RedHat"=>["7", "8"], "Ubuntu"=>["18.04"], "Debian"=>["9", "10"], "VirtuozzoLinux"=>["7"]}
124
+ [10] pry(main)>
125
+ ```
126
+
127
+ ### List supported major puppet versions
128
+
129
+ ```
130
+ [10] pry(main)> metadata.puppet_major_versions
131
+ => [6, 7]
132
+ [11] pry(main)>
133
+ ```
134
+
135
+ ### Check if an operating systems is supported
136
+
137
+ ```
138
+ [6] pry(main)> metadata.os_release_supported?('Archlinux', nil)
139
+ => true
140
+ [7] pry(main)>
141
+ ```
142
+
108
143
  ## Transfer Notice
109
144
 
110
145
  This plugin was originally authored by [Ewoud Kohl van Wijngaarden](https://github.com/ekohl).
@@ -41,6 +41,7 @@ module PuppetMetadata
41
41
  '9' => 5..7,
42
42
  '10' => 5..8,
43
43
  '11' => 6..8,
44
+ '12' => 7..8,
44
45
  },
45
46
  'Ubuntu' => {
46
47
  '14.04' => 5..6,
@@ -19,6 +19,9 @@ module PuppetMetadata
19
19
  # unit files
20
20
  PIDFILE_INCOMPATIBLE = {
21
21
  'CentOS' => ['8'],
22
+ 'AlmaLinux' => ['8'],
23
+ 'OracleLinux' => ['7', '8'],
24
+ 'Rocky' => ['8'],
22
25
  }.freeze
23
26
  class << self
24
27
  # modifies the operating system name to suit beaker-hostgenerator
@@ -63,8 +63,10 @@ module PuppetMetadata
63
63
  else
64
64
  releases&.each do |release|
65
65
  majors.each do |puppet_version|
66
- if AIO.has_aio_build?(os, release, puppet_version[:value]) # rubocop:disable Style/IfUnlessModifier
66
+ if AIO.has_aio_build?(os, release, puppet_version[:value])
67
67
  yield [os, release, puppet_version]
68
+ elsif PuppetMetadata::OperatingSystem.os_release_puppet_version(os, release) == puppet_version[:value]
69
+ yield [os, release, distro_puppet_version.merge(value: puppet_version[:value])]
68
70
  end
69
71
  end
70
72
  end
@@ -32,6 +32,7 @@ module PuppetMetadata
32
32
  # https://wiki.debian.org/DebianReleases
33
33
  'Debian' => {
34
34
  # TODO: EOL is standard support, not the extended life cycle
35
+ '12' => nil, # '~2026',
35
36
  '11' => nil, # '~2024',
36
37
  '10' => nil, # '~2022',
37
38
  '9' => '2020-07-06',
@@ -206,6 +207,33 @@ module PuppetMetadata
206
207
  releases.select { |_release, eol_date| !eol_date || Date.parse(eol_date) > today }.keys
207
208
  .sort_by { |release| Gem::Version.new(release) }
208
209
  end
210
+
211
+ # Return the Puppet major version in an OS release, if any
212
+ #
213
+ # Only tracks releases without an AIO build, since that's preferred.
214
+ #
215
+ # @param [String] operatingsystem
216
+ # The operating system name
217
+ # @param [String] release
218
+ # The operating system release version
219
+ #
220
+ # @return [Optional[Integer]] The Puppet major version, if any
221
+ def os_release_puppet_version(operatingsystem, release)
222
+ case operatingsystem
223
+ when 'Debian'
224
+ case release
225
+ when '12'
226
+ 7
227
+ end
228
+ when 'Fedora'
229
+ case release
230
+ when '39', '40'
231
+ 8
232
+ when '37', '38'
233
+ 7
234
+ end
235
+ end
236
+ end
209
237
  end
210
238
  end
211
239
  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: 3.4.0
4
+ version: 3.6.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: 2023-10-11 00:00:00.000000000 Z
12
+ date: 2024-03-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: metadata-json-lint
@@ -107,14 +107,14 @@ dependencies:
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 2.0.0
110
+ version: 2.5.0
111
111
  type: :development
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 2.0.0
117
+ version: 2.5.0
118
118
  - !ruby/object:Gem::Dependency
119
119
  name: yard
120
120
  requirement: !ruby/object:Gem::Requirement