gluster_volume: Improved parsing of cluster parameter list

This commit is contained in:
Otto Kekäläinen 2015-05-15 17:40:30 +03:00 committed by Matt Clay
parent d76cd4c299
commit c05d2875d1

View file

@ -256,6 +256,7 @@ def probe(host, myhostname):
def probe_all_peers(hosts, peers, myhostname): def probe_all_peers(hosts, peers, myhostname):
for host in hosts: for host in hosts:
host = host.strip() # Clean up any extra space for exact comparison
if host not in peers: if host not in peers:
# dont probe ourselves # dont probe ourselves
if myhostname != host: if myhostname != host:
@ -347,6 +348,11 @@ def main():
if not myhostname: if not myhostname:
myhostname = socket.gethostname() myhostname = socket.gethostname()
# Clean up if last element is empty. Consider that yml can look like this:
# cluster="{% for host in groups['glusterfs'] %}{{ hostvars[host]['private_ip'] }},{% endfor %}"
if cluster != None and cluster[-1] == '':
cluster = cluster[0:-1]
if brick_paths != None and "," in brick_paths: if brick_paths != None and "," in brick_paths:
brick_paths = brick_paths.split(",") brick_paths = brick_paths.split(",")
else: else: