Commit 46ec8759 by Michael DeHaan

Remove the legacy templating code, which was guarded by deprecation warnings in…

Remove the legacy templating code, which was guarded by deprecation warnings in the previous two releases, and undocumented for a long time.  use {{ foo }} to access variables instead of ${foo} or $foo.
parent 9d01d88a
...@@ -75,11 +75,6 @@ def _executor_hook(job_queue, result_queue, new_stdin): ...@@ -75,11 +75,6 @@ def _executor_hook(job_queue, result_queue, new_stdin):
host = job_queue.get(block=False) host = job_queue.get(block=False)
return_data = multiprocessing_runner._executor(host, new_stdin) return_data = multiprocessing_runner._executor(host, new_stdin)
result_queue.put(return_data) result_queue.put(return_data)
if 'LEGACY_TEMPLATE_WARNING' in return_data.flags:
# pass data back up across the multiprocessing fork boundary
template.Flags.LEGACY_TEMPLATE_WARNING = True
except Queue.Empty: except Queue.Empty:
pass pass
except: except:
...@@ -504,15 +499,6 @@ class Runner(object): ...@@ -504,15 +499,6 @@ class Runner(object):
def _executor(self, host, new_stdin): def _executor(self, host, new_stdin):
''' handler for multiprocessing library ''' ''' handler for multiprocessing library '''
def get_flags():
# flags are a way of passing arbitrary event information
# back up the chain, since multiprocessing forks and doesn't
# allow state exchange
flags = []
if template.Flags.LEGACY_TEMPLATE_WARNING:
flags.append('LEGACY_TEMPLATE_WARNING')
return flags
try: try:
fileno = sys.stdin.fileno() fileno = sys.stdin.fileno()
except ValueError: except ValueError:
...@@ -527,7 +513,6 @@ class Runner(object): ...@@ -527,7 +513,6 @@ class Runner(object):
exec_rc = self._executor_internal(host, new_stdin) exec_rc = self._executor_internal(host, new_stdin)
if type(exec_rc) != ReturnData: if type(exec_rc) != ReturnData:
raise Exception("unexpected return type: %s" % type(exec_rc)) raise Exception("unexpected return type: %s" % type(exec_rc))
exec_rc.flags = get_flags()
# redundant, right? # redundant, right?
if not exec_rc.comm_ok: if not exec_rc.comm_ok:
self.callbacks.on_unreachable(host, exec_rc.result) self.callbacks.on_unreachable(host, exec_rc.result)
...@@ -535,11 +520,11 @@ class Runner(object): ...@@ -535,11 +520,11 @@ class Runner(object):
except errors.AnsibleError, ae: except errors.AnsibleError, ae:
msg = str(ae) msg = str(ae)
self.callbacks.on_unreachable(host, msg) self.callbacks.on_unreachable(host, msg)
return ReturnData(host=host, comm_ok=False, result=dict(failed=True, msg=msg), flags=get_flags()) return ReturnData(host=host, comm_ok=False, result=dict(failed=True, msg=msg))
except Exception: except Exception:
msg = traceback.format_exc() msg = traceback.format_exc()
self.callbacks.on_unreachable(host, msg) self.callbacks.on_unreachable(host, msg)
return ReturnData(host=host, comm_ok=False, result=dict(failed=True, msg=msg), flags=get_flags()) return ReturnData(host=host, comm_ok=False, result=dict(failed=True, msg=msg))
# ***************************************************** # *****************************************************
......
...@@ -20,10 +20,10 @@ from ansible import utils ...@@ -20,10 +20,10 @@ from ansible import utils
class ReturnData(object): class ReturnData(object):
''' internal return class for runner execute methods, not part of public API signature ''' ''' internal return class for runner execute methods, not part of public API signature '''
__slots__ = [ 'result', 'comm_ok', 'host', 'diff', 'flags' ] __slots__ = [ 'result', 'comm_ok', 'host', 'diff' ]
def __init__(self, conn=None, host=None, result=None, def __init__(self, conn=None, host=None, result=None,
comm_ok=True, diff=dict(), flags=None): comm_ok=True, diff=dict()):
# which host is this ReturnData about? # which host is this ReturnData about?
if conn is not None: if conn is not None:
...@@ -51,10 +51,6 @@ class ReturnData(object): ...@@ -51,10 +51,6 @@ class ReturnData(object):
if type(self.result) != dict: if type(self.result) != dict:
raise Exception("dictionary result expected") raise Exception("dictionary result expected")
if flags is None:
flags = []
self.flags = []
def communicated_ok(self): def communicated_ok(self):
return self.comm_ok return self.comm_ok
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
# fetch module. # fetch module.
- name: diff what we fetched with the original file - name: diff what we fetched with the original file
shell: diff {{ output_dir }}/orig {{ output_dir }}/fetched/127.0.0.1/root/ansible_testing/orig shell: diff {{ output_dir }}/orig {{ output_dir }}/fetched/127.0.0.1{{ output_dir | expanduser }}/orig
register: diff register: diff
- name: check the diff to make sure they are the same - name: check the diff to make sure they are the same
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment