From 41362e70c223e6f1b7d4bdffd1f92c8a97813a19 Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Mon, 5 May 2008 08:15:14 +0000
Subject: [PATCH] Simplify target generation in DistributeConfig

Currently we get the list of nodes, and for each one extract all its info, and
just to exclude it if the name matches ours. Since the list of nodes is a list
of names just use .remove() to exclude ourself from it, and use that list
directly.

Reviewed-by: iustinp
---
 lib/config.py | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/lib/config.py b/lib/config.py
index dcd6b6b32..a4e889024 100644
--- a/lib/config.py
+++ b/lib/config.py
@@ -544,15 +544,10 @@ class ConfigWriter:
     nodelist = self.GetNodeList()
     myhostname = self._my_hostname
 
-    tgt_list = []
-    for node in nodelist:
-      nodeinfo = self.GetNodeInfo(node)
-      if nodeinfo.name == myhostname:
-        continue
-      tgt_list.append(node)
+    nodelist.remove(myhostname)
 
-    result = rpc.call_upload_file(tgt_list, self._cfg_file)
-    for node in tgt_list:
+    result = rpc.call_upload_file(nodelist, self._cfg_file)
+    for node in nodelist:
       if not result[node]:
         logger.Error("copy of file %s to node %s failed" %
                      (self._cfg_file, node))
-- 
GitLab