Remove internal use of display and use the top-level import

pull/13117/head
James Cammarata 9 years ago
parent 0fc187893d
commit 566144461f

@ -100,13 +100,6 @@ class VariableManager:
self._inventory = None self._inventory = None
self._omit_token = '__omit_place_holder__%s' % sha1(os.urandom(64)).hexdigest() 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): def __getstate__(self):
data = dict( data = dict(
fact_cache = self._fact_cache.copy(), fact_cache = self._fact_cache.copy(),
@ -308,7 +301,7 @@ class VariableManager:
else: else:
# we do not have a full context here, and the missing variable could be # we do not have a full context here, and the missing variable could be
# because of that, so just show a warning and continue # 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 continue
if not C.DEFAULT_PRIVATE_ROLE_VARS: if not C.DEFAULT_PRIVATE_ROLE_VARS:
@ -418,7 +411,7 @@ class VariableManager:
except AnsibleUndefinedVariable as e: except AnsibleUndefinedVariable as e:
if 'has no attribute' in str(e): if 'has no attribute' in str(e):
loop_terms = [] 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: else:
raise raise
items = lookup_loader.get(task.loop, loader=loader, templar=templar).run(terms=loop_terms, variables=vars_copy) items = lookup_loader.get(task.loop, loader=loader, templar=templar).run(terms=loop_terms, variables=vars_copy)

Loading…
Cancel
Save