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

Change subject: packaging: setup: append lines once to hb_hba.conf
......................................................................

packaging: setup: append lines once to hb_hba.conf

Change-Id: I74d80fe6eed1f0eca431d83ba7128950862f8dc6
Signed-off-by: Alon Bar-Lev <alo...@redhat.com>
---
M packaging/setup/plugins/ovirt-engine-setup/provisioning/postgres.py
1 file changed, 25 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/73/18673/1

diff --git 
a/packaging/setup/plugins/ovirt-engine-setup/provisioning/postgres.py 
b/packaging/setup/plugins/ovirt-engine-setup/provisioning/postgres.py
index 8a45e8c..0f59046 100644
--- a/packaging/setup/plugins/ovirt-engine-setup/provisioning/postgres.py
+++ b/packaging/setup/plugins/ovirt-engine-setup/provisioning/postgres.py
@@ -174,35 +174,38 @@
         transaction,
         filename,
     ):
+        lines = [
+            # we cannot use all for address <psql-9
+            (
+                '{host:7} '
+                '{user:15} '
+                '{database:15} '
+                '{address:23} '
+                '{auth}'
+            ).format(
+                host='host',
+                user=self.environment[
+                    osetupcons.DBEnv.USER
+                ],
+                database=self.environment[
+                    osetupcons.DBEnv.DATABASE
+                ],
+                address=address,
+                auth='md5',
+            )
+            for address in ('0.0.0.0/0', '::0/0')
+        ]
+
         content = []
         with open(filename, 'r') as f:
             for line in f.read().splitlines():
-                content.append(line)
+                if line not in lines:
+                    content.append(line)
 
                 # order is important, add after local
                 # so we be first
                 if line.lstrip().startswith('local'):
-                    # we cannot use all for address <psql-9
-                    for address in ('0.0.0.0/0', '::0/0'):
-                        content.append(
-                            (
-                                '{host:7} '
-                                '{user:15} '
-                                '{database:15} '
-                                '{address:23} '
-                                '{auth}'
-                            ).format(
-                                host='host',
-                                user=self.environment[
-                                    osetupcons.DBEnv.USER
-                                ],
-                                database=self.environment[
-                                    osetupcons.DBEnv.DATABASE
-                                ],
-                                address=address,
-                                auth='md5',
-                            )
-                        )
+                    content.extend(lines)
 
         transaction.append(
             filetransaction.FileTransaction(


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I74d80fe6eed1f0eca431d83ba7128950862f8dc6
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <alo...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to