From 3d4e77f44badb996a8e48451603cf9acacb1c3ec Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Tue, 3 Oct 2017 09:59:37 -0500 Subject: [PATCH] Update uptime.py example script with changes to the API. Fixes #31229 (cherry picked from commit 2b08e00a540a538beafd66fc41f602baf1b61c18) --- examples/scripts/uptime.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/scripts/uptime.py b/examples/scripts/uptime.py index 5b92ed78dc..e27c5e83b2 100755 --- a/examples/scripts/uptime.py +++ b/examples/scripts/uptime.py @@ -3,7 +3,7 @@ from collections import namedtuple from ansible.executor.task_queue_manager import TaskQueueManager -from ansible.inventory import Inventory +from ansible.inventory.manager import InventoryManager from ansible.parsing.dataloader import DataLoader from ansible.playbook.play import Play from ansible.plugins.callback import CallbackBase @@ -33,21 +33,21 @@ def main(): host_list = ['localhost', 'www.example.com', 'www.google.com'] Options = namedtuple('Options', ['connection', 'module_path', 'forks', 'remote_user', 'private_key_file', 'ssh_common_args', 'ssh_extra_args', 'sftp_extra_args', - 'scp_extra_args', 'become', 'become_method', 'become_user', 'verbosity', 'check']) + 'scp_extra_args', 'become', 'become_method', 'become_user', 'verbosity', 'check', + 'diff']) # initialize needed objects - variable_manager = VariableManager() loader = DataLoader() options = Options(connection='smart', module_path='/usr/share/ansible', forks=100, remote_user=None, private_key_file=None, ssh_common_args=None, ssh_extra_args=None, sftp_extra_args=None, scp_extra_args=None, become=None, become_method=None, - become_user=None, verbosity=None, check=False) + become_user=None, verbosity=None, check=False, diff=False) passwords = dict() # create inventory and pass to var manager - inventory = Inventory(loader=loader, variable_manager=variable_manager, host_list=host_list) - variable_manager.set_inventory(inventory) + inventory = InventoryManager(loader=loader, sources=','.join(host_list)) + variable_manager = VariableManager(loader=loader, inventory=inventory) # create play with tasks play_source = dict(