mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
updated list_peers to be python2.6 compatible
This commit is contained in:
parent
60737c970e
commit
971ce58cd6
1 changed files with 6 additions and 1 deletions
|
@ -6,6 +6,7 @@ from __future__ import absolute_import
|
|||
|
||||
# Import python libs
|
||||
import logging
|
||||
import sys
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
# Import 3rd-party libs
|
||||
|
@ -106,7 +107,11 @@ def list_peers():
|
|||
|
||||
'''
|
||||
root = _gluster_xml('peer status')
|
||||
result = [x.find('hostname').text for x in root.iter('peer')]
|
||||
|
||||
if sys.version_info < (2, 7):
|
||||
result = [x.find('hostname').text for x in root.getiterator('peer')]
|
||||
else:
|
||||
result = [x.find('hostname').text for x in root.iter('peer')]
|
||||
if len(result) == 0:
|
||||
return None
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue