From 32574aa358219c66d81170bda09542bd4c2a86b0 Mon Sep 17 00:00:00 2001
From: afunix
Date: Wed, 31 Aug 2016 08:27:07 +0300
Subject: [PATCH] gluster_volume module parses out additional hostnames
provided by "gluster peer status" command [#1405] (#2811)
---
lib/ansible/modules/extras/system/gluster_volume.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/lib/ansible/modules/extras/system/gluster_volume.py b/lib/ansible/modules/extras/system/gluster_volume.py
index f7fae041299..9df9bce1114 100644
--- a/lib/ansible/modules/extras/system/gluster_volume.py
+++ b/lib/ansible/modules/extras/system/gluster_volume.py
@@ -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():