Skip to content
30 changes: 30 additions & 0 deletions plans/migrate.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,44 @@
# @param upgrade_version
# Optional version to upgrade to after migration is complete
#
#
plan peadm::migrate (
Peadm::SingleTargetSpec $old_primary_host,
Peadm::SingleTargetSpec $new_primary_host,
Optional[String] $upgrade_version = undef,
Optional[Peadm::SingleTargetSpec] $replica_host = undef,
) {
# pre-migration checks
out::message('This plan is a work in progress and it is not recommended to be used until it is fully implemented and supported')
peadm::assert_supported_bolt_version()
if $upgrade_version and $upgrade_version != '' and !empty($upgrade_version) {
$permit_unsafe_versions = false
peadm::assert_supported_pe_version($version, $permit_unsafe_versions)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like $version still needs to be updated to $upgrade_version here?

}

$all_hosts = peadm::flatten_compact([
$old_primary_host,
$new_primary_host,
])
run_command('hostname', $all_hosts) # verify can connect to targets

Check failure on line 32 in plans/migrate.pp

View workflow job for this annotation

GitHub Actions / Setup Test Matrix

trailing whitespace found (check: trailing_whitespace)

Check failure on line 32 in plans/migrate.pp

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 7.24, Ruby Ver: 2.7)

trailing whitespace found (check: trailing_whitespace)

Check failure on line 32 in plans/migrate.pp

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 8.0, Ruby Ver: 3.2)

trailing whitespace found (check: trailing_whitespace)
if $replica_host != '' and !empty($replica_host) {
run_command('hostname', $replica_host)
}

# verify the cluster we are migrating from is operational and is a supported architecture
$cluster = run_task('peadm::get_peadm_config', $old_primary_host).first.value
$error = getvar('cluster.error')
if $error {
fail_plan($error)
}
$arch = peadm::assert_supported_architecture(
getvar('cluster.params.primary_host'),
getvar('cluster.params.replica_host'),
getvar('cluster.params.primary_postgresql_host'),
getvar('cluster.params.replica_postgresql_host'),
getvar('cluster.params.compiler_hosts'),
)

$backup_file = run_plan('peadm::backup', $old_primary_host, {
backup_type => 'migration',
Expand Down
Loading