1212# Flip this bool to switch which ODBC driver is used for MariaDB projects.
1313mariadb_use_mysql_odbc_driver = True
1414
15+ def make_postgres_odbcinst_ini (csp_container ):
16+ """Generate content for the /etc/odbcinst.ini configuration file used by postgres.
17+ Most of the time this is not needed.
18+
19+ Arguments:
20+ csp_container -- container running iRODS catalog service provider using the ODBC driver
21+ """
22+ odbcinst_ini_path = os .path .join ('/etc' , 'odbcinst.ini' )
23+
24+ logging .debug ('configuring odbcinst.ini with PostgreSQL drivers' )
25+ odbcinst_ini_contents = textwrap .dedent ("""\
26+ [PostgreSQL ANSI]
27+ Description = ODBC for PostgreSQL
28+ Driver = /usr/lib/psqlodbcw.so
29+ Setup = /usr/lib/libodbcpsqlS.so
30+ Driver64 = /usr/lib64/psqlodbcw.so
31+ Setup64 = /usr/lib64/libodbcpsqlS.so
32+ FileUsage = 1
33+ """ )
34+
35+ cmd = 'bash -c \' echo "{0}" > {1}\' ' .format (odbcinst_ini_contents , odbcinst_ini_path )
36+ ec = execute .execute_command (csp_container , cmd )
37+ if ec is not 0 :
38+ raise RuntimeError ('failed to populate odbcinst.ini [ec=[{0}], container=[{1}]]'
39+ .format (ec , csp_container ))
40+
41+ execute .execute_command (csp_container , 'cat {}' .format (odbcinst_ini_path ))
42+
1543def configure_postgres_odbc_driver (csp_container , odbc_driver ):
1644 """Configure ODBC driver for postgres.
1745
@@ -237,14 +265,22 @@ def configure_odbc_driver_rockylinux_9_postgres_17(csp_container, odbc_driver):
237265 """
238266 configure_postgres_odbc_driver (csp_container , odbc_driver )
239267
268+ def configure_odbc_driver_el10_postgres (csp_container , odbc_driver ):
269+ """Configure ODBC driver for postgres on EL10.
270+
271+ Argument:
272+ csp_container -- docker container on which the iRODS catalog service provider is running
273+ """
274+ make_postgres_odbcinst_ini (csp_container )
275+
240276def configure_odbc_driver_almalinux_10_postgres_16 (csp_container , odbc_driver ):
241277 """Configure ODBC driver for postgres 16 on almalinux 10.
242278
243279 Argument:
244280 csp_container -- docker container on which the iRODS catalog service provider is running
245281 odbc_driver -- path to local archive file containing the ODBC driver package
246282 """
247- configure_postgres_odbc_driver (csp_container , odbc_driver )
283+ configure_odbc_driver_el10_postgres (csp_container , odbc_driver )
248284
249285def configure_odbc_driver_almalinux_10_postgres_17 (csp_container , odbc_driver ):
250286 """Configure ODBC driver for postgres 17 on almalinux 10.
@@ -253,7 +289,7 @@ def configure_odbc_driver_almalinux_10_postgres_17(csp_container, odbc_driver):
253289 csp_container -- docker container on which the iRODS catalog service provider is running
254290 odbc_driver -- path to local archive file containing the ODBC driver package
255291 """
256- configure_postgres_odbc_driver (csp_container , odbc_driver )
292+ configure_odbc_driver_el10_postgres (csp_container , odbc_driver )
257293
258294def configure_odbc_driver_rockylinux_10_postgres_16 (csp_container , odbc_driver ):
259295 """Configure ODBC driver for postgres 16 on rockylinux 10.
@@ -262,7 +298,7 @@ def configure_odbc_driver_rockylinux_10_postgres_16(csp_container, odbc_driver):
262298 csp_container -- docker container on which the iRODS catalog service provider is running
263299 odbc_driver -- path to local archive file containing the ODBC driver package
264300 """
265- configure_postgres_odbc_driver (csp_container , odbc_driver )
301+ configure_odbc_driver_el10_postgres (csp_container , odbc_driver )
266302
267303def configure_odbc_driver_rockylinux_10_postgres_17 (csp_container , odbc_driver ):
268304 """Configure ODBC driver for postgres 17 on rockylinux 10.
@@ -271,7 +307,7 @@ def configure_odbc_driver_rockylinux_10_postgres_17(csp_container, odbc_driver):
271307 csp_container -- docker container on which the iRODS catalog service provider is running
272308 odbc_driver -- path to local archive file containing the ODBC driver package
273309 """
274- configure_postgres_odbc_driver (csp_container , odbc_driver )
310+ configure_odbc_driver_el10_postgres (csp_container , odbc_driver )
275311
276312def make_mysql_odbcinst_ini (csp_container , container_odbc_driver_dir ):
277313 """Generate content for the /etc/odbcinst.ini configuration file used by mysql.
0 commit comments