In response to mmornati's problem, I've added some new code to the
mapper.py script and the overlord.py module to detect infinite recursive
conditions and to deal with errors, as if something was borked in your
network tree, weird things would appear in your func delegation map, and
that's bad.
If this patch gets mungled in the e-mail, it's up at
http://thekobayashimaru.org/mapperfix.patch. Here goes:
From 6542f2a37b6f1b751b955fc979bd912d53bf8516 Mon Sep 17 00:00:00 2001
From: Steve Salevan <ssalevan@xxxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 18 Jul 2008 11:59:36 -0400
Subject: [PATCH] Fixing mapper to recognize and fix infinite recursive
loops and error conditions
---
func/minion/modules/overlord.py | 12 ++++++++++--
func/overlord/mapper.py | 6 ++++++
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/func/minion/modules/overlord.py
b/func/minion/modules/overlord.py
index 710f6d1..ca50490 100644
--- a/func/minion/modules/overlord.py
+++ b/func/minion/modules/overlord.py
@@ -30,12 +30,20 @@ class OverlordModule(func_module.FuncModule):
ping_results = fc.Overlord("*").test.ping()
for minion in ping_results.keys():
if ping_results[minion] == 1: #if minion is alive
- current_minions.append(minion) #add it to the list
of current minions
+ current_minions.append(minion) #add it to the list
else:
cm = certmaster.CertMaster()
current_minions = cm.get_signed_certs()
for current_minion in current_minions:
- maphash[current_minion] =
fc.Overlord(current_minion).overlord.map_minions()[current_minion]
+ if current_minion in utils.get_hostname():
+ maphash[current_minion] = {} #prevent infinite recursion
+ else:
+ next_hop = fc.Overlord(current_minion)
+ mapresults =
next_hop.overlord.map_minions()[current_minion]
+ if not utils.is_error(mapresults[current_minion]):
+ maphash[current_minion] = mapresults
+ else:
+ maphash[current_minion] = {}
return maphash
diff --git a/func/overlord/mapper.py b/func/overlord/mapper.py
index 6a1131c..2ed33dd 100755
--- a/func/overlord/mapper.py
+++ b/func/overlord/mapper.py
@@ -21,6 +21,8 @@ import sys
import func.yaml as yaml
import func.overlord.client as func_client
+from func import utils
+
DEFAULT_TREE = "/var/lib/func/map"
class MapperTool(object):
@@ -59,6 +61,10 @@ class MapperTool(object):
minion_hash =
func_client.Overlord("*").overlord.map_minions(self.options.only_alive==True)
+ for minion in minion_hash.keys(): #clean hash of any top-level
errors
+ if utils.is_error(minion_hash[minion]):
+ minion_hash[minion] = {}
+
if self.options.verbose:
print "- built the following map:"
print minion_hash
--
1.5.5.1
_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list