@@ -608,6 +608,7 @@ def get_placeholders(provider):
608608 #pgBackRest
609609 placeholders .setdefault ('USE_PGBACKREST' , False )
610610 placeholders .setdefault ('REPO_HOST' , False )
611+ # CPO-Monitoring
611612 placeholders .setdefault ('cpo_monitoring_stack' , False )
612613 # use namespaces to set WAL bucket prefix scope naming the folder namespace-clustername for non-default namespace.
613614 placeholders .setdefault ('WAL_BUCKET_SCOPE_PREFIX' , '{0}-' .format (placeholders ['NAMESPACE' ])
@@ -1199,11 +1200,18 @@ def main():
11991200 if 'extwlist.extensions' not in user_config .get ('postgresql' , {}).get ('parameters' , {}):
12001201 config ['postgresql' ]['parameters' ]['extwlist.extensions' ] = \
12011202 append_extensions (config ['postgresql' ]['parameters' ]['extwlist.extensions' ], version , True )
1202- # check if cpo-monitoring enabled
12031203 if placeholders ['cpo_monitoring_stack' ]:
1204- config ['postgresql' ]['parameters' ]['shared_preload_libraries' ] = \
1205- append_extensions (config ['postgresql' ]['parameters' ]['shared_preload_libraries' ], 'pgnodemx' )
1204+ current_libraries = config ['postgresql' ]['parameters' ].get ('shared_preload_libraries' , '' )
12061205
1206+ # Check if cpo_monitoring is enabled
1207+ if 'pgnodemx' not in current_libraries .split (',' ):
1208+ current_libraries = config ['postgresql' ]['parameters' ].get ('shared_preload_libraries' , '' )
1209+ if current_libraries :
1210+ config ['postgresql' ]['parameters' ]['shared_preload_libraries' ] = current_libraries + ',' + 'pgnodemx'
1211+ else :
1212+ config ['postgresql' ]['parameters' ]['shared_preload_libraries' ] = 'pgnodemx'
1213+
1214+
12071215
12081216 # Ensure replication is available
12091217 if 'pg_hba' in config ['bootstrap' ] and not any (['replication' in i for i in config ['bootstrap' ]['pg_hba' ]]):
0 commit comments