Cache handler name for included handlers. Fixes #58769 (#58780)

This commit is contained in:
Matt Martz 2019-07-10 13:53:56 -05:00 committed by GitHub
parent 982a36c915
commit d1afcbced1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -0,0 +1,3 @@
bugfixes:
- handlers - Cache templated handler name on included handlers to avoid
later templating errors (https://github.com/ansible/ansible/issues/58769)

View file

@ -891,9 +891,13 @@ class StrategyBase:
if not iterator.is_failed(host) or iterator._play.force_handlers: if not iterator.is_failed(host) or iterator._play.force_handlers:
task_vars = self._variable_manager.get_vars(play=iterator._play, host=host, task=handler) task_vars = self._variable_manager.get_vars(play=iterator._play, host=host, task=handler)
self.add_tqm_variables(task_vars, play=iterator._play) self.add_tqm_variables(task_vars, play=iterator._play)
templar = Templar(loader=self._loader, variables=task_vars)
if not handler.cached_name:
handler.name = templar.template(handler.name)
handler.cached_name = True
self._queue_task(host, handler, task_vars, play_context) self._queue_task(host, handler, task_vars, play_context)
templar = Templar(loader=self._loader, variables=task_vars)
if templar.template(handler.run_once) or bypass_host_loop: if templar.template(handler.run_once) or bypass_host_loop:
break break