-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added fact for detection of replication role.
- Better handling of relationships. - Doing some stuff on master node (instead of only on initial master) - Merged pure_repmgr::register_standby and pure_repmgr::register_master to pure_repmgr::register
- Loading branch information
S. Mannem
committed
Feb 14, 2017
1 parent
f4e9b69
commit af5a084
Showing
5 changed files
with
77 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# == Class: pure_repmgr::register | ||
# Private class | ||
class pure_repmgr::register( | ||
$replication_role = $facts['pure_replication_role'], | ||
) inherits pure_repmgr | ||
{ | ||
$check = $replication_role ? { | ||
'master' => 'False', | ||
'standby' => 'True', | ||
default => '', | ||
} | ||
|
||
if $check == ''{ | ||
fail("Invalid value for \$replication_role: $replication_role") | ||
} | ||
|
||
$cmd = shellquote( "$pg_bin_dir/repmgr", '-f', "${pure_repmgr::repmgr_conf}", $replication_role, 'register') | ||
$unless = shellquote("${pure_postgres::pg_bin_dir}/psql", "-d", "repmgr", "-c", "select * from repmgr_${pure_cloud_cluster}.repl_nodes where pg_is_in_recovery()=$check or name='$fqdn'" ) | ||
|
||
exec { "exec $cmd": | ||
user => $pure_postgres::postgres_user, | ||
command => $cmd, | ||
unless => "/bin/test $($unless | wc -l) -gt 1", | ||
onlyif => "/bin/test -f '${pure_postgres::pg_pid_file}'", | ||
cwd => $pure_postgres::pg_bin_dir, | ||
path => '$pg_bin_dir:/usr/local/bin:/bin', | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.