This is an automated email from the ASF dual-hosted git repository.

jialiang pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 765aef37ac AMBARI-26311: postgresql-server should be installed even 
though ambari-server is configured with mysql (#3945)
765aef37ac is described below

commit 765aef37ac70ef4dcf6f79625a55f19943c8fb36
Author: Yubi Lee <[email protected]>
AuthorDate: Thu Nov 27 14:23:25 2025 +0900

    AMBARI-26311: postgresql-server should be installed even though 
ambari-server is configured with mysql (#3945)
---
 ambari-server/src/main/python/ambari_server/dbCleanup.py       | 10 +++++++++-
 .../src/main/python/ambari_server/dbConfiguration_linux.py     |  5 +++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/ambari-server/src/main/python/ambari_server/dbCleanup.py 
b/ambari-server/src/main/python/ambari_server/dbCleanup.py
index fe792c23f4..22883dc9e3 100644
--- a/ambari-server/src/main/python/ambari_server/dbCleanup.py
+++ b/ambari-server/src/main/python/ambari_server/dbCleanup.py
@@ -20,13 +20,18 @@ limitations under the License.
 
 from ambari_commons.logging_utils import print_info_msg, print_error_msg
 from ambari_commons.os_utils import run_os_command
-from ambari_server.dbConfiguration import ensure_jdbc_driver_is_installed
+from ambari_server.dbConfiguration import (
+  ensure_jdbc_driver_is_installed,
+  LINUX_DBMS_KEYS_LIST,
+)
 from ambari_server.serverConfiguration import (
   configDefaults,
   get_ambari_properties,
   get_java_exe_path,
   read_ambari_user,
   get_db_type,
+  parse_properties_file,
+  JDBC_DATABASE_PROPERTY,
 )
 from ambari_server.setupSecurity import (
   generate_env,
@@ -106,6 +111,9 @@ def run_db_purge(options):
     )
     return 1
 
+  properties = get_ambari_properties()
+  parse_properties_file(options)
+  options.database_index = 
LINUX_DBMS_KEYS_LIST.index(properties[JDBC_DATABASE_PROPERTY])
   ensure_jdbc_driver_is_installed(options, get_ambari_properties())
 
   server_class_path = ServerClassPath(get_ambari_properties(), options)
diff --git 
a/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py 
b/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
index 44521cbcd5..d2e572a35f 100644
--- a/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
+++ b/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
@@ -524,6 +524,7 @@ class PGConfig(LinuxDBMSConfig):
   PG_STATUS_STOPPED = "stopped"
   PG_SERVICE_NAME = "postgresql"
   PG_HBA_DIR = None
+  PG_INITDB_CMD = None
 
   if (
     OSCheck.is_redhat_family()
@@ -541,8 +542,6 @@ class PGConfig(LinuxDBMSConfig):
         if psql_service_file:
           psql_service_file_name = os.path.basename(psql_service_file[0])
           PG_SERVICE_NAME = psql_service_file_name[:-8]  # remove .service
-      else:
-        raise FatalException(1, "Cannot find postgresql-setup script.")
 
     SERVICE_CMD = "/usr/bin/env systemctl"
     PG_ST_CMD = f"{SERVICE_CMD} status {PG_SERVICE_NAME}"
@@ -598,6 +597,8 @@ class PGConfig(LinuxDBMSConfig):
   )
 
   def __init__(self, options, properties, storage_type):
+    if PGConfig.PG_INITDB_CMD is None:
+      raise FatalException(1, "Cannot find postgresql-setup script.")
     super(PGConfig, self).__init__(options, properties, storage_type)
 
     # Init the database configuration data here, if any


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to