diff options
author | Steve Salevan <ssalevan@marillion.rdu.redhat.com> | 2008-07-18 11:59:36 -0400 |
---|---|---|
committer | Steve Salevan <ssalevan@marillion.rdu.redhat.com> | 2008-07-18 11:59:36 -0400 |
commit | 6542f2a37b6f1b751b955fc979bd912d53bf8516 (patch) | |
tree | 9d5b4a8540f523a57217cb096b050e54fa33a208 /func | |
parent | 7f524383cc7f975545ff51e8719c0bffdbd114e7 (diff) | |
download | func-6542f2a37b6f1b751b955fc979bd912d53bf8516.tar.gz func-6542f2a37b6f1b751b955fc979bd912d53bf8516.tar.xz func-6542f2a37b6f1b751b955fc979bd912d53bf8516.zip |
Fixing mapper to recognize and fix infinite recursive loops and error conditions
Diffstat (limited to 'func')
-rw-r--r-- | func/minion/modules/overlord.py | 12 | ||||
-rwxr-xr-x | 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 |