Skip to content

replace_failed_postgresql fails if the failed_postgresql_host is primary_postgresql_host #591

@LordKa0S

Description

@LordKa0S

# Get current peadm config before making modifications
$peadm_config = run_task('peadm::get_peadm_config', $primary_host).first.value

This fails if the failed_postgresql_host is primary_postgresql_host.

Starting: task peadm::get_peadm_config on primary_host.pe.com
Finished: task peadm::get_peadm_config with 1 failure in 3.78 sec
Finished: plan peadm::replace_failed_postgresql in 4.57 sec
Failed on primary_host.pe.com:
  The task failed with exit code 1 and no stdout, but stderr contained:
  /opt/puppetlabs/puppet/lib/ruby/3.2.0/json/common.rb:216:in `parse': unexpected token at 'primary_postgresql_host.pe.com' (JSON::ParserError)
  	from /opt/puppetlabs/puppet/lib/ruby/3.2.0/json/common.rb:216:in `parse'
  	from /tmp/56e1243f-3c8e-45cb-97ed-0b649938e2e7/get_peadm_config.rb:144:in `pdb_query'
  	from /tmp/56e1243f-3c8e-45cb-97ed-0b649938e2e7/get_peadm_config.rb:125:in `server'
  	from /tmp/56e1243f-3c8e-45cb-97ed-0b649938e2e7/get_peadm_config.rb:27:in `config'
  	from /tmp/56e1243f-3c8e-45cb-97ed-0b649938e2e7/get_peadm_config.rb:17:in `execute!'
  	from /tmp/56e1243f-3c8e-45cb-97ed-0b649938e2e7/get_peadm_config.rb:189:in `<main>'
Failed on 1 target: primary_host.pe.com
Ran on 1 target

Steps to Reproduce

bolt plan run peadm::install --inventory $inventory_path --params @$params_path

echo 'Simulating failure'

bolt plan run peadm::uninstall --targets $primary_postgresql_host --inventory $inventory_path

echo 'Recovering from failure'

bolt plan run peadm::replace_failed_postgresql primary_host=$primary_host replica_host=$replica_host working_postgresql_host=$replica_postgresql_host failed_postgresql_host=$primary_postgresql_host replacement_postgresql_host=$primary_postgresql_host --inventory $inventory_path

Additional Context

Maybe this needs to be moved up to before the get_peadm_config?

# Temporarily set both primary and replica server nodes so that they use the remaining healthy PE-PostgreSQL server
run_plan('peadm::util::update_db_setting', $pe_hosts,

Case# 01387097
cc: @davidmalloncares

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions