Alon Bar-Lev has uploaded a new change for review.

Change subject: packaging: engine-cleanup: drop user as well
......................................................................

packaging: engine-cleanup: drop user as well

currently we drop database, but we create user as well,
no reason why not to attempt remove it.

Change-Id: I5cc437890d7cce686329435c12d82a50ab0df4b0
Signed-off-by: Alon Bar-Lev <[email protected]>
---
M packaging/fedora/setup/basedefs.py
M packaging/fedora/setup/engine-cleanup.py
2 files changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/63/14363/1

diff --git a/packaging/fedora/setup/basedefs.py 
b/packaging/fedora/setup/basedefs.py
index eec4b93..0d4f78d 100644
--- a/packaging/fedora/setup/basedefs.py
+++ b/packaging/fedora/setup/basedefs.py
@@ -187,6 +187,7 @@
 EXEC_PSQL="/usr/bin/psql"
 EXEC_PGRESTORE="/usr/bin/pg_restore"
 EXEC_DROPDB="/usr/bin/dropdb"
+EXEC_DROPUSER="/usr/bin/dropuser"
 EXEC_SHELL="/bin/sh"
 EXEC_SSH_KEYGEN="/usr/bin/ssh-keygen"
 EXEC_SYSCTL="/sbin/sysctl"
diff --git a/packaging/fedora/setup/engine-cleanup.py 
b/packaging/fedora/setup/engine-cleanup.py
index a5cf081..3da9f13 100755
--- a/packaging/fedora/setup/engine-cleanup.py
+++ b/packaging/fedora/setup/engine-cleanup.py
@@ -39,6 +39,7 @@
 Check that connection is working and rerun the cleanup utility"
 MSG_ERROR_BACKUP_DB = "Error: Database backup failed"
 MSG_ERROR_DROP_DB = "Error: DB drop operation failed. Check that there are no 
active connection to the '%s' DB"
+MSG_ERROR_DROP_USER = "Warning: Could not drop user '%s' from database"
 MSG_ERROR_CHECK_LOG = "Error: Cleanup failed.\nplease check log at %s"
 MSG_ERR_FAILED_ENGINE_SERVICE_STILL_RUN = "Error: Can't stop ovirt-engine 
service. Please shut it down manually."
 MSG_ERR_FAILED_STP_ENGINE_SERVICE = "Error: Can't stop ovirt-engine"
@@ -356,6 +357,17 @@
             if rc:
                 logging.error(MSG_ERROR_DROP_DB % dbname)
                 raise Exception(MSG_ERROR_DROP_DB % dbname)
+        cmd = [
+            basedefs.EXEC_DROPUSER,
+            "-w",
+            "-U", basedefs.DB_ADMIN,
+            "-h", DB_HOST,
+            "-p", DB_PORT,
+            basedefs.DB_USER,
+        ]
+        output, rc = utils.execCmd(cmdList=cmd, failOnError=False, 
msg=MSG_ERROR_DROP_USER, envDict=self.env)
+        if rc:
+            logging.warning(MSG_ERROR_DROP_USER % basedefs.DB_USER)
         self.dropped = True
         logging.debug("DB Drop completed successfully")
 


--
To view, visit http://gerrit.ovirt.org/14363
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5cc437890d7cce686329435c12d82a50ab0df4b0
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to