Skip to content

Commit 2ca1619

Browse files
(PE-40386) alternate avail_group_letter for migration
1 parent ddef526 commit 2ca1619

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

plans/add_database.pp

+9-10
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,15 @@
6161
out::message("Operating in ${operating_mode} mode")
6262

6363
if $operating_mode == 'init' {
64-
# if we are doing a migration then we need to assign the new node to group A
65-
if $is_migration {
66-
$avail_group_letter = 'A'
67-
} else {
68-
# If no other PSQL node then match primary group letter
69-
$avail_group_letter = peadm::flatten_compact($roles['server'].map |$k,$v| {
70-
if $v == $primary_host {
71-
$k
72-
}
73-
})[0]
64+
# If no other PSQL node then match primary group letter
65+
$calculated_group_letter = peadm::flatten_compact($roles['server'].map |$k,$v| {
66+
if $v == $primary_host {
67+
$k
68+
}
69+
})[0]
70+
$avail_group_letter = $calculated_group_letter ? {
71+
undef => $is_migration ? { true => 'A', default => undef },
72+
default => $calculated_group_letter,
7473
}
7574
# Assume PuppetDB backend hosted on Primary if in init mode
7675
$source_db_host = $primary_host

0 commit comments

Comments
 (0)