add back in support of towervars lost in merge

This commit is contained in:
AlanCoding
2017-12-13 14:28:04 -05:00
parent bd91e8eb54
commit 1b0bca8229
3 changed files with 29 additions and 2 deletions

View File

@@ -209,7 +209,7 @@ class Inventory(CommonModelNameNotUnique, ResourceMixin):
group_children.add(from_group_id)
return group_children_map
def get_script_data(self, hostvars=False, show_all=False):
def get_script_data(self, hostvars=False, towervars=False, show_all=False):
if show_all:
hosts_q = dict()
else:
@@ -271,6 +271,10 @@ class Inventory(CommonModelNameNotUnique, ResourceMixin):
data['_meta'].setdefault('hostvars', dict())
for host in self.hosts.filter(**hosts_q):
data['_meta']['hostvars'][host.name] = host.variables_dict
if towervars:
tower_dict = dict(remote_tower_enabled=str(host.enabled).lower(),
remote_tower_id=host.id)
data['_meta']['hostvars'][host.name].update(tower_dict)
return data