- add pgsql backend capabilities for grafana - create/manage pgsql database for grafana - fix psql_is_slave fact to work on all current patroni clusters - fix extra } in resources - fix unless in psql grant commands - fix add database owner - fix disabled schema permissions, the unless didnt work
17 lines
496 B
Ruby
17 lines
496 B
Ruby
# frozen_string_literal: true
|
|
|
|
Facter.add(:psql_is_slave) do
|
|
confine enc_role: [
|
|
'roles::infra::sql::patroni',
|
|
'roles::infra::sql::shared',
|
|
'roles::infra::puppetdb::sql'
|
|
]
|
|
setcode do
|
|
# Command to check if PostgreSQL is in recovery mode
|
|
command = 'sudo -iu postgres psql -tAc "select pg_is_in_recovery()"'
|
|
|
|
# Execute the command and map the output to a boolean value
|
|
{ 't' => true, 'f' => false }[Facter::Core::Execution.execute(command, on_fail: nil)]
|
|
end
|
|
end
|