From 566144461f67560ef19e7b1319d7775b00f2aa3f Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Tue, 10 Nov 2015 12:02:29 -0500 Subject: [PATCH] Remove internal use of display and use the top-level import --- lib/ansible/vars/__init__.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/ansible/vars/__init__.py b/lib/ansible/vars/__init__.py index 20cb58adebb..ad2b2d1dc46 100644 --- a/lib/ansible/vars/__init__.py +++ b/lib/ansible/vars/__init__.py @@ -100,13 +100,6 @@ class VariableManager: self._inventory = None self._omit_token = '__omit_place_holder__%s' % sha1(os.urandom(64)).hexdigest() - try: - from __main__ import display - self._display = display - except ImportError: - from ansible.utils.display import Display - self._display = Display() - def __getstate__(self): data = dict( fact_cache = self._fact_cache.copy(), @@ -308,7 +301,7 @@ class VariableManager: else: # we do not have a full context here, and the missing variable could be # because of that, so just show a warning and continue - self._display.vvv("skipping vars_file '%s' due to an undefined variable" % vars_file_item) + display.vvv("skipping vars_file '%s' due to an undefined variable" % vars_file_item) continue if not C.DEFAULT_PRIVATE_ROLE_VARS: @@ -418,7 +411,7 @@ class VariableManager: except AnsibleUndefinedVariable as e: if 'has no attribute' in str(e): loop_terms = [] - self._display.deprecated("Skipping task due to undefined attribute, in the future this will be a fatal error.") + display.deprecated("Skipping task due to undefined attribute, in the future this will be a fatal error.") else: raise items = lookup_loader.get(task.loop, loader=loader, templar=templar).run(terms=loop_terms, variables=vars_copy)