summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Shubin <james@shubin.ca>2013-12-28 16:40:46 -0500
committerJames Shubin <james@shubin.ca>2013-12-28 16:54:43 -0500
commita8d2d9f73e66670e5b9ef1ebff84cc2eb14da603 (patch)
tree9c3b3694d67e4510ce30c26e49a7b3f7a295e4fd
parentfcd9ec7f5d868753145027e764add098c0a98c46 (diff)
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.
-rw-r--r--files/xml.py7
1 files changed, 5 insertions, 2 deletions
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