From a3d563a646dd6225efa88e0c9b14c4957d460753 Mon Sep 17 00:00:00 2001 From: Dustin Black Date: Fri, 16 Feb 2018 10:06:53 -0500 Subject: [PATCH] adjust parsing of peers for differing data structures from xml output --- zeroconf/actions.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/zeroconf/actions.py b/zeroconf/actions.py index 6ef71b3..e11b5b1 100644 --- a/zeroconf/actions.py +++ b/zeroconf/actions.py @@ -64,7 +64,12 @@ def connected_peers(): if not (result['cliOutput'] and result['cliOutput']['peerStatus']): return peers - for peer in result['cliOutput']['peerStatus']['peer']: + if isinstance(result['cliOutput']['peerStatus']['peer'], (list,)): + xmlPeers = result['cliOutput']['peerStatus']['peer'] + else: + xmlPeers = result['cliOutput']['peerStatus'].values() + + for peer in xmlPeers: hostname = peer['hostname'] if hostname != 'localhost': peers.append(hostname)