Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove misleading group vars as they are flat #32276

Merged
merged 2 commits into from
Oct 30, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions lib/ansible/cli/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def _show_vars(self, dump, depth):
self._remove_internal(dump)
if self.options.show_vars:
for (name, val) in sorted(dump.items()):
result.append(self._graph_name('{%s = %s}' % (name, val), depth + 1))
result.append(self._graph_name('{%s = %s}' % (name, val), depth))
return result

def _graph_name(self, name, depth=0):
Expand All @@ -231,7 +231,7 @@ def _graph_group(self, group, depth=0):
if group.name != 'all':
for host in sorted(group.hosts, key=attrgetter('name')):
result.append(self._graph_name(host.name, depth))
result.extend(self._show_vars(host.get_vars(), depth))
result.extend(self._show_vars(host.get_vars(), depth + 1))

result.extend(self._show_vars(group.get_vars(), depth))

Expand All @@ -252,7 +252,6 @@ def format_group(group):
results[group.name] = {}
if group.name != 'all':
results[group.name]['hosts'] = [h.name for h in sorted(group.hosts, key=attrgetter('name'))]
results[group.name]['vars'] = group.get_vars()
results[group.name]['children'] = []
for subgroup in sorted(group.child_groups, key=attrgetter('name')):
results[group.name]['children'].append(subgroup.name)
Expand Down Expand Up @@ -281,7 +280,6 @@ def format_group(group):

# initialize group + vars
results[group.name] = {}
results[group.name]['vars'] = group.get_vars()

# subgroups
results[group.name]['children'] = {}
Expand Down