Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(PE-39352) Add version to get peadm config #527

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions tasks/get_peadm_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
jpartlow marked this conversation as resolved.
Show resolved Hide resolved
puts config.to_json
else
puts({ 'error' => 'This is not a peadm-compatible cluster. Use peadm::convert first.' }).to_json
Expand Down Expand Up @@ -41,6 +41,7 @@ def config

# Build and return the task output
{
'pe_version' => pe_version,
'params' => {
'primary_host' => primary,
'replica_host' => replica,
Expand Down Expand Up @@ -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
Expand Down
Loading