Skip to content

Commit

Permalink
Merge pull request #3 from dustinblack/fix_discover_connected_peers
Browse files Browse the repository at this point in the history
adjust parsing of peers for differing data structures from xml output
  • Loading branch information
ramkrsna committed Feb 19, 2018
2 parents 7853aac + a3d563a commit b14763e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion zeroconf/actions.py
Expand Up @@ -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)
Expand Down

0 comments on commit b14763e

Please sign in to comment.