From a8d2d9f73e66670e5b9ef1ebff84cc2eb14da603 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Sat, 28 Dec 2013 16:40:46 -0500 Subject: Properly iterate over all the peers. Not sure how this bug ever happened. Did the format of the xml ever change? In any case, now it's squashed. --- files/xml.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'files/xml.py') diff --git a/files/xml.py b/files/xml.py index c072819..b75906f 100644 --- a/files/xml.py +++ b/files/xml.py @@ -97,8 +97,11 @@ if args.mode == 'connected': store = {} peers = args.peers - for i in root.findall('.//peerStatus'): - p = i.find('peer') + l = root.findall('.//peerStatus') + if len(l) != 1: + sys.exit(3) + + for p in l[0].findall('.//peer'): h = p.find('hostname').text c = (str(p.find('connected').text) == '1') # connected...? s = (str(p.find('state').text) in VALID_PEERED) # valid peering -- cgit