From df0d770b4150e0f3dc26ef5c5cd0d2dbb3a4e24b Mon Sep 17 00:00:00 2001 From: Matteo Abis <1423701+Enucatl@users.noreply.github.com> Date: Tue, 10 Oct 2023 13:21:50 +0200 Subject: [PATCH 1/7] enable puppet 8 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 2216a88..3814b4a 100644 --- a/metadata.json +++ b/metadata.json @@ -60,7 +60,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">=5.0.0 < 8.0.0" + "version_requirement": ">=5.0.0 < 9.0.0" } ], "tags": [ From c2bb324267a13822629f81f2602694eb2e01e57e Mon Sep 17 00:00:00 2001 From: Matteo Abis <1423701+Enucatl@users.noreply.github.com> Date: Tue, 10 Oct 2023 19:23:37 +0200 Subject: [PATCH 2/7] require puppet/parameter/boolean needed to import Boolean type --- lib/puppet/type/libvirt_domain.rb | 3 +++ lib/puppet/type/libvirt_network.rb | 3 +++ lib/puppet/type/libvirt_nwfilter.rb | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/puppet/type/libvirt_domain.rb b/lib/puppet/type/libvirt_domain.rb index 9e4a1bd..1a2718e 100644 --- a/lib/puppet/type/libvirt_domain.rb +++ b/lib/puppet/type/libvirt_domain.rb @@ -1,5 +1,8 @@ # frozen_string_literal: true +require 'puppet/parameter/boolean' + + Puppet::Type.newtype(:libvirt_domain) do @doc = 'ensures a persistent domain (vm) (transient domains are ignored) ' diff --git a/lib/puppet/type/libvirt_network.rb b/lib/puppet/type/libvirt_network.rb index 7c46939..87668ca 100644 --- a/lib/puppet/type/libvirt_network.rb +++ b/lib/puppet/type/libvirt_network.rb @@ -1,5 +1,8 @@ # frozen_string_literal: true +require 'puppet/parameter/boolean' + + Puppet::Type.newtype(:libvirt_network) do @doc = 'ensures a persistent network (transient networks are ignored) ' diff --git a/lib/puppet/type/libvirt_nwfilter.rb b/lib/puppet/type/libvirt_nwfilter.rb index 186a914..6cd8669 100644 --- a/lib/puppet/type/libvirt_nwfilter.rb +++ b/lib/puppet/type/libvirt_nwfilter.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true -# +require 'puppet/parameter/boolean' + Puppet::Type.newtype(:libvirt_nwfilter) do @doc = 'ensures a nwfilter From baab6515901c35e764cb7b1677ef31ee8c38283d Mon Sep 17 00:00:00 2001 From: Matteo Abis <1423701+Enucatl@users.noreply.github.com> Date: Tue, 10 Oct 2023 19:57:06 +0200 Subject: [PATCH 3/7] add rexml gem for ruby 3 --- Gemfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Gemfile b/Gemfile index 5b241e2..ce2ae60 100644 --- a/Gemfile +++ b/Gemfile @@ -56,6 +56,10 @@ gems['puppet'] = location_for(puppet_version) gems['facter'] = location_for(facter_version) if facter_version gems['hiera'] = location_for(hiera_version) if hiera_version +if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3") + # https://stackoverflow.com/questions/65479863/rails-6-1-ruby-3-0-0-tests-error-as-they-cannot-load-rexml + gems['rexml'] = '~> 3.2' +endif gems.each do |gem_name, gem_params| gem gem_name, *gem_params From 893d154e333feb5ff9b45287da0bf920df975e09 Mon Sep 17 00:00:00 2001 From: Matteo Abis <1423701+Enucatl@users.noreply.github.com> Date: Tue, 10 Oct 2023 20:32:06 +0200 Subject: [PATCH 4/7] add comment --- Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile b/Gemfile index ce2ae60..e8f7dd6 100644 --- a/Gemfile +++ b/Gemfile @@ -57,6 +57,7 @@ gems['puppet'] = location_for(puppet_version) gems['facter'] = location_for(facter_version) if facter_version gems['hiera'] = location_for(hiera_version) if hiera_version if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3") + # rexml is not a bundled gem in ruby 3 # https://stackoverflow.com/questions/65479863/rails-6-1-ruby-3-0-0-tests-error-as-they-cannot-load-rexml gems['rexml'] = '~> 3.2' endif From b697b8fe993e0bce35715cfc84173e58169e151d Mon Sep 17 00:00:00 2001 From: Matteo Abis <1423701+Enucatl@users.noreply.github.com> Date: Tue, 10 Oct 2023 22:17:23 +0200 Subject: [PATCH 5/7] remove gem from Gemfile --- Gemfile | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Gemfile b/Gemfile index e8f7dd6..5b241e2 100644 --- a/Gemfile +++ b/Gemfile @@ -56,11 +56,6 @@ gems['puppet'] = location_for(puppet_version) gems['facter'] = location_for(facter_version) if facter_version gems['hiera'] = location_for(hiera_version) if hiera_version -if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3") - # rexml is not a bundled gem in ruby 3 - # https://stackoverflow.com/questions/65479863/rails-6-1-ruby-3-0-0-tests-error-as-they-cannot-load-rexml - gems['rexml'] = '~> 3.2' -endif gems.each do |gem_name, gem_params| gem gem_name, *gem_params From 835b860f5eea8964d669557659011a77ca85e210 Mon Sep 17 00:00:00 2001 From: Matteo Abis <1423701+Enucatl@users.noreply.github.com> Date: Tue, 10 Oct 2023 23:00:09 +0200 Subject: [PATCH 6/7] remove blank lines for pdk validate --- lib/puppet/type/libvirt_domain.rb | 1 - lib/puppet/type/libvirt_network.rb | 1 - lib/puppet/type/libvirt_nwfilter.rb | 1 - 3 files changed, 3 deletions(-) diff --git a/lib/puppet/type/libvirt_domain.rb b/lib/puppet/type/libvirt_domain.rb index 1a2718e..aa151ea 100644 --- a/lib/puppet/type/libvirt_domain.rb +++ b/lib/puppet/type/libvirt_domain.rb @@ -2,7 +2,6 @@ require 'puppet/parameter/boolean' - Puppet::Type.newtype(:libvirt_domain) do @doc = 'ensures a persistent domain (vm) (transient domains are ignored) ' diff --git a/lib/puppet/type/libvirt_network.rb b/lib/puppet/type/libvirt_network.rb index 87668ca..a8f123c 100644 --- a/lib/puppet/type/libvirt_network.rb +++ b/lib/puppet/type/libvirt_network.rb @@ -2,7 +2,6 @@ require 'puppet/parameter/boolean' - Puppet::Type.newtype(:libvirt_network) do @doc = 'ensures a persistent network (transient networks are ignored) ' diff --git a/lib/puppet/type/libvirt_nwfilter.rb b/lib/puppet/type/libvirt_nwfilter.rb index 6cd8669..21a4e46 100644 --- a/lib/puppet/type/libvirt_nwfilter.rb +++ b/lib/puppet/type/libvirt_nwfilter.rb @@ -2,7 +2,6 @@ require 'puppet/parameter/boolean' - Puppet::Type.newtype(:libvirt_nwfilter) do @doc = 'ensures a nwfilter ' From 82043e79d3fdaacc281224be0df355c82766f2d7 Mon Sep 17 00:00:00 2001 From: Matteo Abis <1423701+Enucatl@users.noreply.github.com> Date: Tue, 10 Oct 2023 23:11:39 +0200 Subject: [PATCH 7/7] add rexml gem to .sync.yml and instructions on README --- .sync.yml | 4 +++- Gemfile | 1 + README.md | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.sync.yml b/.sync.yml index 8974464..8158496 100644 --- a/.sync.yml +++ b/.sync.yml @@ -12,4 +12,6 @@ Gemfile: ':development': - gem: 'puppet-blacksmith' - gem: 'github_changelog_generator' - + - gem: 'rexml' + version: '~> 3.2' + condition: "Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3')" diff --git a/Gemfile b/Gemfile index 5b241e2..4a398ec 100644 --- a/Gemfile +++ b/Gemfile @@ -37,6 +37,7 @@ group :development do gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] gem "puppet-blacksmith", require: false gem "github_changelog_generator", require: false + gem "rexml", '~> 3.2', require: false if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3') end group :system_tests do gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw] diff --git a/README.md b/README.md index d4a5c19..daccaf6 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,13 @@ 5. [Contributing](#contributing) ## Upgrade warnings: + +Upgrading to puppet 8 comes with Ruby 3, which doesn't have the `rexml` gem bundled. +It should be [installed on the puppetserver](https://www.puppet.com/docs/puppet/7/server/gems.html#installing-and-removing-gems). +``` +sudo puppetserver gem install rexml +``` + Upgrade to version 5.x.x introduced types/providers for network, nwfilter and domains replacing the execs used before version 5.0.0. To compare the XML's generated with puppet and the actual running XML's generated with virsh they are sorted which leads to display lots of