Skip to content

Commit 4b27d8f

Browse files
authored
[FIX] Fix ansible get_vars calls in sync and inventory (#42)
1 parent c58f78d commit 4b27d8f

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/ops/cli/inventory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def get_inventory_hosts(self, args):
6262
return self.ansible_inventory.get_hosts(limit)
6363

6464
def get_host_facts(self, host, indent="\t"):
65-
vars = self.ansible_inventory.get_vars(host)
65+
vars = host.get_vars()
6666
vars = {unicode(key): var for key, var in vars.items()} # the yaml dumper doesn't handle mixed keys encoding
6767
ret = yaml.dump(vars, indent=4, allow_unicode=True, default_flow_style=False, Dumper=AnsibleDumper)
6868
ret = "\n".join([indent + line for line in ret.split("\n")])

src/ops/cli/sync.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ def run(self, args):
7777
remote_hosts.append('{}--{}'.format(bastion, remote.pattern))
7878
else:
7979
for host in hosts:
80-
vars = self.ansible_inventory.get_vars(host)
81-
ssh_host = vars.get('ansible_ssh_host') or host
80+
ssh_host = host.get_vars().get('ansible_ssh_host') or host
8281
remote_hosts.append(ssh_host)
8382

8483
for ssh_host in remote_hosts:

0 commit comments

Comments
 (0)