gluster_volume module parses out additional hostnames provided by "gluster peer status" command [#1405] (#2811)

This commit is contained in:
afunix 2016-08-31 08:27:07 +03:00 committed by Matt Clay
parent 4017be741a
commit 32574aa358

View file

@ -181,16 +181,24 @@ def get_peers():
hostname = None
uuid = None
state = None
shortNames = False
for row in out.split('\n'):
if ': ' in row:
key, value = row.split(': ')
if key.lower() == 'hostname':
hostname = value
shortNames = False
if key.lower() == 'uuid':
uuid = value
if key.lower() == 'state':
state = value
peers[hostname] = [ uuid, state ]
elif row.lower() == 'other names:':
shortNames = True
elif row != '' and shortNames == True:
peers[row] = [ uuid, state ]
elif row == '':
shortNames = False
return peers
def get_volumes():