[node-patches] Change in ovirt-node[master]: network: Remove outdated servers

fabiand at fedoraproject.org fabiand at fedoraproject.org
Wed Sep 11 10:30:49 UTC 2013


Fabian Deutsch has uploaded a new change for review.

Change subject: network: Remove outdated servers
......................................................................

network: Remove outdated servers

Previously it could happen that servers which were removed in the TUI
didn't get removed in teh actual config files.
This is now fixed by removing all existing servers and writing the new
ones.

Change-Id: I412f046b603c9fe0a3d6768f1a8ced3dc263b07e
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=982534
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M src/ovirt/node/config/network.py
1 file changed, 9 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/20/19120/1

diff --git a/src/ovirt/node/config/network.py b/src/ovirt/node/config/network.py
index 3f01c29..1b04133 100644
--- a/src/ovirt/node/config/network.py
+++ b/src/ovirt/node/config/network.py
@@ -182,15 +182,19 @@
     for path in aug.match(augpath):
         servers.append(aug.get(path))
 
+    LOGGER.debug("Current servers: %s" % servers)
+
     if new_servers:
         itempath = lambda idx: "%s[%d]" % (augpath, idx + 1)
+        LOGGER.debug("Removing old servers")
+        for idx, server in enumerate(servers):
+            LOGGER.debug("Removing server %s: %s" % (itempath(idx),
+                                                     server))
+            aug.remove(itempath(idx))
+        LOGGER.debug("Setting new servers")
         for idx, server in enumerate(new_servers):
-            LOGGER.debug("Setting server: %s" % server)
+            LOGGER.debug("Setting server %s: %s" % (itempath(idx), server))
             aug.set(itempath(idx), server)
-        if len(servers) > len(new_servers):
-            LOGGER.debug("Less servers than before, removing old ones")
-            for idx in range(len(servers) + 1, len(new_servers)):
-                aug.remove(itempath(idx))
     return servers
 
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I412f046b603c9fe0a3d6768f1a8ced3dc263b07e
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>



More information about the node-patches mailing list