From 0c039c2ba504678f65f07abc36efa8af715aeef9 Mon Sep 17 00:00:00 2001 From: Serban Teodorescu Date: Tue, 30 Jul 2019 16:54:16 +0300 Subject: [PATCH] [FIX] Fix ansible get_vars calls in sync and inventory --- src/ops/cli/inventory.py | 2 +- src/ops/cli/sync.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ops/cli/inventory.py b/src/ops/cli/inventory.py index a424556e..254aff78 100644 --- a/src/ops/cli/inventory.py +++ b/src/ops/cli/inventory.py @@ -62,7 +62,7 @@ def get_inventory_hosts(self, args): return self.ansible_inventory.get_hosts(limit) def get_host_facts(self, host, indent="\t"): - vars = self.ansible_inventory.get_vars(host) + vars = host.get_vars() vars = {unicode(key): var for key, var in vars.items()} # the yaml dumper doesn't handle mixed keys encoding ret = yaml.dump(vars, indent=4, allow_unicode=True, default_flow_style=False, Dumper=AnsibleDumper) ret = "\n".join([indent + line for line in ret.split("\n")]) diff --git a/src/ops/cli/sync.py b/src/ops/cli/sync.py index 57451229..2f38ec18 100644 --- a/src/ops/cli/sync.py +++ b/src/ops/cli/sync.py @@ -77,8 +77,7 @@ def run(self, args): remote_hosts.append('{}--{}'.format(bastion, remote.pattern)) else: for host in hosts: - vars = self.ansible_inventory.get_vars(host) - ssh_host = vars.get('ansible_ssh_host') or host + ssh_host = host.get_vars().get('ansible_ssh_host') or host remote_hosts.append(ssh_host) for ssh_host in remote_hosts: