Fix hiera_lookup unescape special characters.

Fix the 'puppet lookup' command to unescape special characters.

Test Plan:
  PASS: Use Ruby CLI to test different password possibilites.
  PASS: Build packages.
  PASS: Build iso image.
  PASS: Fresh install Duplex using admin_password starting with
  special characters.
  PASS: Fresh install Duplex using admin_passwod not starting
  special characters
  PASS: Fresh install Duplex using default admin_password

Closes-Bug: 2020148
Change-Id: Ifde68b457a12e808a9878b0cd472c21cea2a1c04
Signed-off-by: Guilherme Schons <guilherme.dossantosschons@windriver.com>
This commit is contained in:
Guilherme Schons 2023-05-19 02:30:49 -03:00 committed by Guilherme Schons
parent 0aa36aeaad
commit 5970d3dce9
4 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,28 @@
From 0071ccbc87326971769e207af6b6a592571e3bf1 Mon Sep 17 00:00:00 2001
From: Guilherme Schons <guilherme.dossantosschons@windriver.com>
Date: Fri, 19 May 2023 02:22:26 -0300
Subject: [PATCH] Fix hiera_lookup function to unescape characters
Fix the 'puppet lookup' command to unescape special characters.
Signed-off-by: Guilherme Schons <guilherme.dossantosschons@windriver.com>
---
lib/puppet/provider/keystone.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/puppet/provider/keystone.rb b/lib/puppet/provider/keystone.rb
index 2544942..2dd9ce9 100644
--- a/lib/puppet/provider/keystone.rb
+++ b/lib/puppet/provider/keystone.rb
@@ -227,7 +227,7 @@ class Puppet::Provider::Keystone < Puppet::Provider::Openstack
### STX Modifications (Start) ###
def self.hiera_lookup(key)
- %x(sudo puppet lookup #{key})[4...-1]
+ %x(sudo puppet lookup #{key} | sed 's,\",,g')[4...-1]
end
def self.initial_config_primary?
--
2.25.1

View File

@ -5,3 +5,4 @@
0005-Replace-deprecated-idle_timeout-parameter.patch
0006-fix-paths-for-openstack-libs.patch
0007-Replace-deprecated-hiera-function.patch
0008-Fix-hiera_lookup-function-to-unescape-characters.patch

View File

@ -0,0 +1,28 @@
From c9317e396969dbadce6d2161c0135defaff1815f Mon Sep 17 00:00:00 2001
From: Guilherme Schons <guilherme.dossantosschons@windriver.com>
Date: Fri, 19 May 2023 11:21:21 -0300
Subject: [PATCH] Fix hiera_lookup function to unescape characters
Unescape special characters from the 'puppet lookup' command return.
Signed-off-by: Guilherme Schons <guilherme.dossantosschons@windriver.com>
---
lib/puppet/provider/openstack/auth.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/puppet/provider/openstack/auth.rb b/lib/puppet/provider/openstack/auth.rb
index 99a8733..e388805 100644
--- a/lib/puppet/provider/openstack/auth.rb
+++ b/lib/puppet/provider/openstack/auth.rb
@@ -6,7 +6,7 @@ module Puppet::Provider::Openstack::Auth
RCFILENAME = "/etc/platform/openrc"
def lookup_hiera(key)
- %(sudo puppet lookup #{key})[4...-1]
+ %(sudo puppet lookup #{key} | sed 's,\",,g')[4...-1]
end
def get_admin_password
--
2.25.1

View File

@ -2,3 +2,4 @@
0002-Replace-deprecated-hiera-function.patch
0003-Adjust-puppetlabs-postgresql-version-requirement.patch
0004-Increase-timeout-from-40s-to-100s.patch
0005-Fix-hiera_lookup-function-to-unescape-characters.patch