From 532aebbab5eb1d0a971db29361e0313183cdab2d Mon Sep 17 00:00:00 2001 From: Josh Partlow Date: Fri, 22 Nov 2024 19:25:00 +0000 Subject: [PATCH 1/2] (maint) Fix GetPEAdmConfig node group test for peadm cluster The 'PE HA Replica' node group is present in all PE installations, installed with or without PEADM. Switched this to check for the 'PE Primary A' node group that a PEADM installation specifically creates. --- tasks/get_peadm_config.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tasks/get_peadm_config.rb b/tasks/get_peadm_config.rb index e4bb7ba4..86f6f36e 100755 --- a/tasks/get_peadm_config.rb +++ b/tasks/get_peadm_config.rb @@ -11,9 +11,9 @@ class GetPEAdmConfig def initialize(params); end def execute! - # if there is no 'PE HA Replica' node group, it's not a peadm-configured cluster. - replica_group = groups.data.find { |obj| obj['name'] == 'PE HA Replica' } - if replica_group + # if there is no 'PE Primary A' node group, it's not a peadm-configured cluster. + peadm_primary_a_group = groups.data.find { |obj| obj['name'] == 'PE Primary A' } + if peadm_primary_a_group puts config.to_json else puts({ 'error' => 'This is not a peadm-compatible cluster. Use peadm::convert first.' }).to_json From 7e77c2103e28f97fe35ffd380a34a9891ea20ac9 Mon Sep 17 00:00:00 2001 From: Josh Partlow Date: Fri, 22 Nov 2024 19:27:20 +0000 Subject: [PATCH 2/2] (PE-39352,PE-39351) Gather PE version in get_peadm_config task Adds a lookup of the pe_build file to provide the PE version in the hash returned by the get_peadm_config task. We will use this in add_database and backup/restore plans as a version gate for handling the newer host_action_collector database that is only present in PE 2023.7+, for example. --- tasks/get_peadm_config.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tasks/get_peadm_config.rb b/tasks/get_peadm_config.rb index 86f6f36e..9eb3aa02 100755 --- a/tasks/get_peadm_config.rb +++ b/tasks/get_peadm_config.rb @@ -41,6 +41,7 @@ def config # Build and return the task output { + 'pe_version' => pe_version, 'params' => { 'primary_host' => primary, 'replica_host' => replica, @@ -73,6 +74,12 @@ def config } end + # @return [String] Local PE version string. + def pe_version + pe_build_file = '/opt/puppetlabs/server/pe_build' + File.read(pe_build_file).strip if File.exist?(pe_build_file) + end + # Returns a GetPEAdmConfig::NodeGroups object created from the /groups object # returned by the classifier def groups