new ansible outputs localhost instead of 127.0.0.1
Change-Id: I7b07b66fea5302e578207e7c615a157362171fa7
diff --git a/xos/synchronizers/base/ansible.py b/xos/synchronizers/base/ansible.py
index e5077a4..cea9686 100644
--- a/xos/synchronizers/base/ansible.py
+++ b/xos/synchronizers/base/ansible.py
@@ -27,6 +27,8 @@
for l in lines:
magic_str = 'ok: [127.0.0.1] => '
magic_str2 = 'changed: [127.0.0.1] => '
+ magic_str3 = 'ok: [localhost] => '
+ magic_str4 = 'changed: [localhost] => '
if (l.startswith(magic_str)):
w = len(magic_str)
str = l[w:]
@@ -46,6 +48,25 @@
d = json.loads(str)
results.append(d)
+ elif (l.startswith(magic_str3)):
+ w = len(magic_str3)
+ str = l[w:]
+
+ # handle ok: [127.0.0.1] => (item=org.onosproject.driver) => {...
+ if str.startswith("(") and (" => {" in str):
+ str = str.split("=> ",1)[1]
+
+ d = json.loads(str)
+ results.append(d)
+ elif (l.startswith(magic_str4)):
+ w = len(magic_str4)
+ str = l[w:]
+
+ if str.startswith("(") and (" => {" in str):
+ str = str.split("=> ",1)[1]
+
+ d = json.loads(str)
+ results.append(d)
return results