Skip to content

Commit cd436e8

Browse files
committed
fixes in tune tool
1 parent 67fb133 commit cd436e8

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

mamonsu/tools/tune/pgsql.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# -*- coding: utf-8 -*-
22
import sys
33
import logging
4+
import os
5+
import re
46

57
import mamonsu.lib.platform as platform
68
from mamonsu.plugins.pgsql.pool import Pooler
@@ -67,10 +69,18 @@ def _configure_extensions(self):
6769
else:
6870
libraries = libraries.split(',')
6971
libraries = [ext.strip() for ext in libraries]
70-
if needed_libraries not in libraries:
71-
for ext in needed_libraries:
72-
if ext not in libraries:
73-
libraries.append(ext)
72+
for candidate_ext in needed_libraries:
73+
extension_found = False
74+
for installed_ext in libraries:
75+
# $dir/ext => ext
76+
installed_ext = os.path.basename(installed_ext)
77+
installed_ext = re.sub('\.so$', '', installed_ext)
78+
installed_ext = re.sub('\.dll$', '', installed_ext)
79+
# if any found
80+
if installed_ext == candidate_ext:
81+
extension_found = True
82+
if not extension_found:
83+
libraries.append(candidate_ext)
7484
libraries = ','.join(libraries)
7585
self._run_query(
7686
"alter system set shared_preload_libraries to {0};".format(

0 commit comments

Comments
 (0)