You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use hash_behaviour=merge (e.g. in ansible.cfg) in our roles heavy env. In this case, it would be helpful to show the resulting dictionary as additive instead of exclusive. For example, the show_diff function could display output showing previous items, new items, and merged items.
I can simply modify the show_diff function to suit my case, but it may be useful to other people to add this as an option.
--- /Library/Python/2.7/site-packages/ansible_toolkit/show_vars.py.orig 2016-02-26 16:59:12.000000000 -0800
+++ /Library/Python/2.7/site-packages/ansible_toolkit/show_vars.py 2016-02-26 17:07:33.000000000 -0800
@@ -9,8 +9,15 @@
if k in old.keys() and v == old[k]:
continue
if k in old.keys() and v != old[k]:
- red(" - ['{}'] = {}".format(k, old[k]))
- green(" + ['{}'] = {}".format(k, v))
+ # as if hash_behaviour = merge
+ z = old[k].copy()
+ z.update(v)
+
+ green(" p ['{}'] = {}".format(k, old[k]))
+ red(" + ['{}'] = {}".format(k, v))
+ green(" = ['{}'] = {}".format(k, z))
+ else:
+ green(" + ['{}'] = {}".format(k, v))
The text was updated successfully, but these errors were encountered:
We use hash_behaviour=merge (e.g. in ansible.cfg) in our roles heavy env. In this case, it would be helpful to show the resulting dictionary as additive instead of exclusive. For example, the show_diff function could display output showing previous items, new items, and merged items.
I can simply modify the show_diff function to suit my case, but it may be useful to other people to add this as an option.
The text was updated successfully, but these errors were encountered: