From 213a9abdd41f0d3de9090839b70f5b57bf4c72fd Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 9 Sep 2025 16:15:24 +0200 Subject: [PATCH] Switch from puppet releases to openvox releases --- README.md | 12 ++- Rakefile | 33 +----- ext/openvox_agent_facter_versions.json | 17 ++++ ext/puppet_agent_facter_versions.json | 133 ------------------------- lib/rspec-puppet-facts.rb | 2 +- spec/rspec_puppet_facts_spec.rb | 13 ++- 6 files changed, 39 insertions(+), 171 deletions(-) create mode 100644 ext/openvox_agent_facter_versions.json delete mode 100644 ext/puppet_agent_facter_versions.json diff --git a/README.md b/README.md index e7fa091..bd92fd8 100644 --- a/README.md +++ b/README.md @@ -572,9 +572,15 @@ When no facts are available for the specific facter/operating system combination ## Maintenance This gem uses information about puppet AIO component versions to build/test. -They are stored at `ext/puppet_agent_facter_versions.json`. If they are outdated, -the `puppet_versions:test` rake task will fail and they need to be updated. -This is as easy as running: `bundle exec rake puppet_versions:update` +They are stored at `ext/puppet_agent_facter_versions.json`. + +In the past we used `bundle exec rake puppet_versions:update` to update the file and `puppet_versions:test` to validate it. +This relied on information from the puppet forge. +With the 6.0.0 release we're switching to openvox. +The file is currently maintained by hand, because openvox doesn't offer an API yet to map agent releases to openfact releases. +It got also renamed from `ext/puppet_agent_facter_versions.json` -> `ext/openvox_agent_facter_versions.json`. + +**`ext/openvox_agent_facter_versions.json`now lists a mapping of openvox releases to openfact releases** ## License diff --git a/Rakefile b/Rakefile index 60ec2ca..6f34bfc 100644 --- a/Rakefile +++ b/Rakefile @@ -21,39 +21,14 @@ end namespace :puppet_versions do desc 'updates the vendored list of puppet versions & components' task :update do - require 'net/http' - require 'net/https' - require 'uri' - require 'json' - - uri = URI.parse('https://forgeapi.puppet.com/private/versions/puppet-agent') - http = Net::HTTP.new(uri.host, uri.port) - http.use_ssl = uri.scheme == 'https' - - request = Net::HTTP::Get.new(uri.request_uri) - response = http.request(request) - raise unless response.is_a?(Net::HTTPSuccess) - - data = JSON.parse(response.body).filter_map do |_, versions| - if !versions['puppet'].nil? && !versions['facter'].nil? - [versions['puppet'], versions['facter']] - end - end - data.sort_by! { |puppet, _facter| Gem::Version.new(puppet) }.reverse! - - File.write(PUPPET_VERSIONS_PATH, "#{JSON.pretty_generate(data.to_h)}\n") + warn 'The rake task is disabled since the 6.0.0 Release. Please see the README.md' + exit 1 end desc 'runs all tests and verifies vendored component list' task :test do - Rake::Task['puppet_versions:update'].invoke - - output = `git status --porcelain #{PUPPET_VERSIONS_PATH}` - unless output.strip.empty? - warn "#{PUPPET_VERSIONS_PATH} is out of date." - warn 'Run the puppet_versions:update task to update it and commit the changes.' - raise - end + warn 'The rake task is disabled since the 6.0.0 Release. Please see the README.md' + exit 1 end end diff --git a/ext/openvox_agent_facter_versions.json b/ext/openvox_agent_facter_versions.json new file mode 100644 index 0000000..ca9776d --- /dev/null +++ b/ext/openvox_agent_facter_versions.json @@ -0,0 +1,17 @@ +{ + "8.23.1": "5.1.0", + "8.23.0": "5.1.0", + "8.22.1": "5.0.0", + "8.19.2": "4.11.0", + "8.19.1": "4.11.0", + "8.19.0": "4.11.0", + "8.18.1": "4.11.0", + "8.17.0": "4.11.0", + "8.16.0": "4.11.0", + "8.15.0": "4.11.0", + "8.14.0": "4.11.0", + "8.13.0": "4.11.0", + "8.12.1": "4.11.0", + "8.12.0": "4.11.0", + "8.11.0": "4.11.0" +} diff --git a/ext/puppet_agent_facter_versions.json b/ext/puppet_agent_facter_versions.json deleted file mode 100644 index fc1c7e8..0000000 --- a/ext/puppet_agent_facter_versions.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "8.12.0": "4.12.0", - "8.11.0": "4.11.0", - "8.10.0": "4.10.0", - "8.9.0": "4.9.0", - "8.8.1": "4.8.0", - "8.8.0": "4.8.0", - "8.7.0": "4.7.1", - "8.6.0": "4.7.0", - "8.5.1": "4.6.1", - "8.5.0": "4.6.0", - "8.4.0": "4.5.2", - "8.3.1": "4.5.1", - "8.3.0": "4.5.1", - "8.2.0": "4.4.2", - "8.1.0": "4.4.1-2-g785cfa2ae", - "8.0.0": "4.4.0", - "7.35.0": "4.11.0", - "7.34.0": "4.10.0", - "7.33.0": "4.9.0", - "7.32.1": "4.8.0", - "7.32.0": "4.8.0", - "7.31.0": "4.7.1", - "7.30.0": "4.7.0", - "7.29.1": "4.6.1", - "7.29.0": "4.6.0", - "7.28.0": "4.5.2", - "7.27.0": "4.5.1", - "7.26.0": "4.4.2", - "7.25.0": "4.4.1", - "7.24.0": "4.3.1", - "7.23.0": "4.3.0", - "7.21.0": "4.2.14", - "7.20.0": "4.2.13", - "7.19.0": "4.2.12", - "7.18.0": "4.2.11", - "7.17.0": "4.2.10", - "7.16.0": "4.2.8", - "7.15.0": "4.2.8", - "7.14.0": "4.2.7", - "7.13.1": "4.2.6", - "7.13.0": "4.2.6", - "7.12.1": "4.2.5", - "7.12.0": "4.2.5", - "7.11.0": "4.2.4", - "7.10.0": "4.2.3", - "7.9.0": "4.2.2", - "7.8.0": "4.2.1", - "7.7.0": "4.2.0", - "7.6.1": "4.1.1", - "7.6.0": "4.1.0", - "7.5.0": "4.0.52", - "7.4.1": "4.0.51", - "7.4.0": "4.0.51", - "7.3.0": "4.0.49", - "7.1.0": "4.0.47", - "7.0.0": "4.0.46", - "6.28.0": "3.14.24", - "6.27.0": "3.14.23", - "6.26.0": "3.14.22", - "6.25.1": "3.14.21", - "6.25.0": "3.14.20", - "6.24.0": "3.14.19", - "6.23.0": "3.14.18", - "6.22.1": "3.14.17", - "6.22.0": "3.14.17", - "6.21.1": "3.14.16", - "6.21.0": "3.14.16", - "6.20.0": "3.14.15", - "6.19.1": "3.14.14", - "6.19.0": "3.14.14", - "6.18.0": "3.14.13", - "6.17.0": "3.14.12", - "6.16.0": "3.14.11", - "6.15.0": "3.14.10", - "6.14.0": "3.14.9", - "6.13.0": "3.14.8", - "6.12.0": "3.14.7", - "6.11.1": "3.14.6", - "6.11.0": "3.14.6", - "6.10.1": "3.14.5", - "6.10.0": "3.14.5", - "6.9.0": "3.14.4", - "6.8.1": "3.14.3", - "6.8.0": "3.14.3", - "6.7.2": "3.14.2", - "6.7.1": "3.14.2", - "6.7.0": "3.14.2", - "6.6.0": "3.14.1", - "6.5.0": "3.14.0", - "6.4.5": "3.13.5", - "6.4.4": "3.13.4", - "6.4.3": "3.13.3", - "6.4.2": "3.13.2", - "6.4.1": "3.13.2", - "6.4.0": "3.13.1", - "6.3.0": "3.13.0", - "6.2.0": "3.12.3", - "6.0.10": "3.12.5", - "6.0.9": "3.12.4", - "6.0.8": "3.12.4", - "6.0.7": "3.12.4", - "6.0.5": "3.12.3", - "5.5.22": "3.11.14", - "5.5.21": "3.11.14", - "5.5.20": "3.11.13", - "5.5.19": "3.11.12", - "5.5.18": "3.11.11", - "5.5.17": "3.11.10", - "5.5.16": "3.11.9", - "5.5.15": "3.11.9", - "5.5.14": "3.11.8", - "5.5.13": "3.11.8", - "5.5.12": "3.11.8", - "5.5.11": "3.11.8", - "5.5.10": "3.11.7", - "5.5.9": "3.11.7", - "5.4.0": "3.10.0", - "5.3.5": "3.9.5", - "5.3.4": "3.9.4", - "5.3.3": "3.9.3", - "5.3.2": "3.9.2", - "5.3.1": "3.9.2", - "5.3.0": "3.9.1", - "5.2.0": "3.9.0", - "5.1.0": "3.8.0", - "4.10.13": "3.6.11", - "4.10.10": "3.6.9", - "4.10.9": "3.6.8", - "4.10.8": "3.6.7", - "4.10.7": "3.6.7", - "4.10.6": "3.6.6" -} diff --git a/lib/rspec-puppet-facts.rb b/lib/rspec-puppet-facts.rb index 2c93db0..83aeffe 100644 --- a/lib/rspec-puppet-facts.rb +++ b/lib/rspec-puppet-facts.rb @@ -403,7 +403,7 @@ def self.facter_version_to_loose_requirement_string(version) def self.facter_version_for_puppet_version(puppet_version) return Facter.version if puppet_version.nil? - json_path = File.expand_path(File.join(__dir__, '..', 'ext', 'puppet_agent_facter_versions.json')) + json_path = File.expand_path(File.join(__dir__, '..', 'ext', 'openvox_agent_facter_versions.json')) unless File.file?(json_path) && File.readable?(json_path) warning "#{json_path} does not exist or is not readable, defaulting to Facter #{Facter.version}" return Facter.version diff --git a/spec/rspec_puppet_facts_spec.rb b/spec/rspec_puppet_facts_spec.rb index 64868be..1e4c440 100644 --- a/spec/rspec_puppet_facts_spec.rb +++ b/spec/rspec_puppet_facts_spec.rb @@ -21,7 +21,7 @@ end let(:component_json_path) do - File.expand_path(File.join(__dir__, '..', 'ext', 'puppet_agent_facter_versions.json')) + File.expand_path(File.join(__dir__, '..', 'ext', 'openvox_agent_facter_versions.json')) end let(:puppet_version) { Puppet.version } @@ -98,18 +98,21 @@ end context 'when passed a known Puppet version' do - let(:puppet_version) { '5.2.0' } + let(:puppet_version) { '8.11.0' } it 'returns the Facter version for that Puppet version' do - expect(facter_version).to eq('3.9.0') + expect(facter_version).to eq('4.11.0') end end context 'when passed a Puppet version between two known versions' do - let(:puppet_version) { '5.2.5' } + # openvox 8.19.0 has facter 4.11.0 + # openvox 8.22.1 has openfact 5.0.0 + # openvox 9.18.5 doesn't exist + let(:puppet_version) { '8.19.5' } it 'returns the Facter version for the lower Puppet version' do - expect(facter_version).to eq('3.9.0') + expect(facter_version).to eq('4.11.0') end end