Alex Lourie has uploaded a new change for review.

Change subject: packaging: removing .pgpass when cleaning DB
......................................................................

packaging: removing .pgpass when cleaning DB

We previously used to remove the contents that we put
into the pgpass file. In fact, when we remove the DB
we no longer need this file. So we back it up and remove.

Change-Id: Iff8df6a57bcdf231cbbb54ea732c1fca4afe3a1d
Signed-off-by: Alex Lourie <alou...@redhat.com>
---
M packaging/fedora/setup/engine-cleanup.py
1 file changed, 3 insertions(+), 21 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/13/11113/1

diff --git a/packaging/fedora/setup/engine-cleanup.py 
b/packaging/fedora/setup/engine-cleanup.py
index d8cd990..14c815c 100755
--- a/packaging/fedora/setup/engine-cleanup.py
+++ b/packaging/fedora/setup/engine-cleanup.py
@@ -183,27 +183,9 @@
     try:
         backupFile = "%s.%s" % (basedefs.DB_PASS_FILE, 
utils.getCurrentDateTime())
         logging.debug("Found %s file, backing current to %s" % 
(basedefs.DB_PASS_FILE, backupFile))
-        shutil.copyfile(basedefs.DB_PASS_FILE, backupFile)
-
-        lines = []
-        with open(basedefs.DB_PASS_FILE, 'r') as f:
-            lines = f.read().split('\n')
-            inEngine = None
-            newLines = lines[:]
-            for line in newLines:
-                if basedefs.PGPASS_FILE_HEADER_LINE.split('\n')[0] in line:
-                    inEngine=True
-
-                if basedefs.PGPASS_FILE_CLOSING_LINE in line:
-                    lines.remove(line)
-                    inEngine=False
-
-                if inEngine:
-                    lines.remove(line)
-
-        with open(basedefs.DB_PASS_FILE, 'w') as f:
-            for line in lines:
-                f.write("%s\n" % line)
+        # Remove file as not needed after cleanup
+        # It is our file, so we can just rename it.
+        shutil.move(basedefs.DB_PASS_FILE, backupFile)
 
     except:
         logging.error("Failed to clean %s" % basedefs.DB_PASS_FILE)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iff8df6a57bcdf231cbbb54ea732c1fca4afe3a1d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alex Lourie <alou...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to