From 0235b4598253f8689b8831f547d0e4815bd4e0fd Mon Sep 17 00:00:00 2001 From: Matheus Machado Guilhermino Date: Thu, 21 Apr 2022 17:19:51 -0300 Subject: [PATCH] Debian: Replace hiera function and fix openstacklib path The HieraPuppet.lookup() function malfunctions when hiera v5 is used. In order to have Hiera v5 working, the function was replaced by the 'puppet lookup' command. Hiera v5 should be used instead of Hiera v3 to avoid the following warning during bootstrap: "/etc/puppet/hiera.yaml: Use of 'hiera.yaml' version 3 is deprecated. It should be converted to version 5" Also replaced the default path in which keystone.rb looks for openstacklib since a custom installation directory is being used. Debian Bullseye tests: PASS: Build & install PASS: Successful Bootstrap Story: 2009964 Task: 45008 Signed-off-by: Matheus Machado Guilhermino Change-Id: I570aa6e06448e00b96882629b54882a1467740c5 --- .../0006-fix-paths-for-openstack-libs.patch | 31 ++++++++++++++++ ...07-Replace-deprecated-hiera-function.patch | 37 +++++++++++++++++++ .../debian/patches/series | 2 + ...02-Replace-deprecated-hiera-function.patch | 35 ++++++++++++++++++ .../debian/patches/series | 1 + 5 files changed, 106 insertions(+) create mode 100644 config/puppet-modules/openstack/puppet-keystone-17.4.0/debian/patches/0006-fix-paths-for-openstack-libs.patch create mode 100644 config/puppet-modules/openstack/puppet-keystone-17.4.0/debian/patches/0007-Replace-deprecated-hiera-function.patch create mode 100644 config/puppet-modules/openstack/puppet-openstacklib-17.4.0/debian/patches/0002-Replace-deprecated-hiera-function.patch diff --git a/config/puppet-modules/openstack/puppet-keystone-17.4.0/debian/patches/0006-fix-paths-for-openstack-libs.patch b/config/puppet-modules/openstack/puppet-keystone-17.4.0/debian/patches/0006-fix-paths-for-openstack-libs.patch new file mode 100644 index 000000000..b464c73fb --- /dev/null +++ b/config/puppet-modules/openstack/puppet-keystone-17.4.0/debian/patches/0006-fix-paths-for-openstack-libs.patch @@ -0,0 +1,31 @@ +From 781294eab3bb437195d479054777ffdc300dd243 Mon Sep 17 00:00:00 2001 +From: Matheus Machado Guilhermino +Date: Thu, 21 Apr 2022 19:50:20 +0000 +Subject: [PATCH] fix paths for openstack libs + +openstacklib is not installed to the default directory. +This patch replaces the default path with the custom path. + +Signed-off-by: Matheus Machado Guilhermino +--- + lib/puppet/provider/keystone.rb | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/lib/puppet/provider/keystone.rb b/lib/puppet/provider/keystone.rb +index b0756fd..6809f7b 100644 +--- a/lib/puppet/provider/keystone.rb ++++ b/lib/puppet/provider/keystone.rb +@@ -1,7 +1,7 @@ + require 'puppet/util/inifile' +-require 'puppet/provider/openstack' +-require 'puppet/provider/openstack/auth' +-require 'puppet/provider/openstack/credentials' ++require File.join(File.dirname(__FILE__), '..','..','..','..', 'openstacklib/lib/puppet/provider/openstack') ++require File.join(File.dirname(__FILE__), '..','..','..','..', 'openstacklib/lib/puppet/provider/openstack/auth') ++require File.join(File.dirname(__FILE__), '..','..','..','..', 'openstacklib/lib/puppet/provider/openstack/credentials') + require File.join(File.dirname(__FILE__), '..','..', 'puppet/provider/keystone/util') + require 'hiera_puppet' + +-- +2.30.2 + diff --git a/config/puppet-modules/openstack/puppet-keystone-17.4.0/debian/patches/0007-Replace-deprecated-hiera-function.patch b/config/puppet-modules/openstack/puppet-keystone-17.4.0/debian/patches/0007-Replace-deprecated-hiera-function.patch new file mode 100644 index 000000000..eef6c8db9 --- /dev/null +++ b/config/puppet-modules/openstack/puppet-keystone-17.4.0/debian/patches/0007-Replace-deprecated-hiera-function.patch @@ -0,0 +1,37 @@ +From 3140cb1a78235ac6504a97e5e3bd4fe79b455b36 Mon Sep 17 00:00:00 2001 +From: Matheus Machado Guilhermino +Date: Thu, 21 Apr 2022 20:01:21 +0000 +Subject: [PATCH] Replace deprecated hiera function + +Replaced the deprecated 'HieraPuppet.lookup()' function with the +'puppet lookup' command. + +Signed-off-by: Matheus Machado Guilhermino +--- + lib/puppet/provider/keystone.rb | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/lib/puppet/provider/keystone.rb b/lib/puppet/provider/keystone.rb +index 6809f7b..2544942 100644 +--- a/lib/puppet/provider/keystone.rb ++++ b/lib/puppet/provider/keystone.rb +@@ -3,7 +3,6 @@ require File.join(File.dirname(__FILE__), '..','..','..','..', 'openstacklib/lib + require File.join(File.dirname(__FILE__), '..','..','..','..', 'openstacklib/lib/puppet/provider/openstack/auth') + require File.join(File.dirname(__FILE__), '..','..','..','..', 'openstacklib/lib/puppet/provider/openstack/credentials') + require File.join(File.dirname(__FILE__), '..','..', 'puppet/provider/keystone/util') +-require 'hiera_puppet' + + class Puppet::Provider::Keystone < Puppet::Provider::Openstack + +@@ -228,7 +227,7 @@ class Puppet::Provider::Keystone < Puppet::Provider::Openstack + ### STX Modifications (Start) ### + + def self.hiera_lookup(key) +- HieraPuppet.lookup(key, :undef, self, nil, :priority) ++ %x(sudo puppet lookup #{key})[4...-1] + end + + def self.initial_config_primary? +-- +2.30.2 + diff --git a/config/puppet-modules/openstack/puppet-keystone-17.4.0/debian/patches/series b/config/puppet-modules/openstack/puppet-keystone-17.4.0/debian/patches/series index 75d16292b..ef133114e 100644 --- a/config/puppet-modules/openstack/puppet-keystone-17.4.0/debian/patches/series +++ b/config/puppet-modules/openstack/puppet-keystone-17.4.0/debian/patches/series @@ -3,3 +3,5 @@ 0003-Update-Barbican-admin-secret-s-user-project-IDs-duri.patch 0004-Update-puppet-keystone-sync.patch 0005-Replace-deprecated-idle_timeout-parameter.patch +0006-fix-paths-for-openstack-libs.patch +0007-Replace-deprecated-hiera-function.patch diff --git a/config/puppet-modules/openstack/puppet-openstacklib-17.4.0/debian/patches/0002-Replace-deprecated-hiera-function.patch b/config/puppet-modules/openstack/puppet-openstacklib-17.4.0/debian/patches/0002-Replace-deprecated-hiera-function.patch new file mode 100644 index 000000000..c75ee91e9 --- /dev/null +++ b/config/puppet-modules/openstack/puppet-openstacklib-17.4.0/debian/patches/0002-Replace-deprecated-hiera-function.patch @@ -0,0 +1,35 @@ +From 864ce60461737423b4487390dd232caecbba4985 Mon Sep 17 00:00:00 2001 +From: Matheus Machado Guilhermino +Date: Thu, 21 Apr 2022 20:16:47 +0000 +Subject: [PATCH] Replace deprecated hiera function + +Replaced the deprecated 'HieraPuppet.lookup()' function with the +'puppet lookup' command. + +Signed-off-by: Matheus Machado Guilhermino +--- + lib/puppet/provider/openstack/auth.rb | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/lib/puppet/provider/openstack/auth.rb b/lib/puppet/provider/openstack/auth.rb +index 4026aec..99a8733 100644 +--- a/lib/puppet/provider/openstack/auth.rb ++++ b/lib/puppet/provider/openstack/auth.rb +@@ -1,13 +1,12 @@ + #require 'puppet/provider/openstack/credentials' + require File.join(File.dirname(__FILE__), '..','..','..', 'puppet/provider/openstack/credentials') +-require 'hiera_puppet' + + module Puppet::Provider::Openstack::Auth + + RCFILENAME = "/etc/platform/openrc" + + def lookup_hiera(key) +- HieraPuppet.lookup(key, :undef, self, nil, :priority) ++ %(sudo puppet lookup #{key})[4...-1] + end + + def get_admin_password +-- +2.30.2 + diff --git a/config/puppet-modules/openstack/puppet-openstacklib-17.4.0/debian/patches/series b/config/puppet-modules/openstack/puppet-openstacklib-17.4.0/debian/patches/series index 563d1ae6a..a9f755647 100644 --- a/config/puppet-modules/openstack/puppet-openstacklib-17.4.0/debian/patches/series +++ b/config/puppet-modules/openstack/puppet-openstacklib-17.4.0/debian/patches/series @@ -1 +1,2 @@ 0001-Adapt-first-set-of-legacy-patches.patch +0002-Replace-deprecated-hiera-function.patch