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

pull/58945/head
Matt Martz 5 years ago committed by GitHub
parent 982a36c915
commit d1afcbced1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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)

@ -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

Loading…
Cancel
Save