Commit 7bc789ba by James Cammarata

Properly template task names

Also fixes in the correct way the bug in which the role name was
incorrectly showing up twice in the task name.

Fixes #10347
parent 698479a6
...@@ -97,7 +97,7 @@ class Task(Base, Conditional, Taggable, Become): ...@@ -97,7 +97,7 @@ class Task(Base, Conditional, Taggable, Become):
def get_name(self): def get_name(self):
''' return the name of the task ''' ''' return the name of the task '''
if self._role and self.name and not self.name.startswith("%s :" % self._role.get_name()): if self._role and self.name:
return "%s : %s" % (self._role.get_name(), self.name) return "%s : %s" % (self._role.get_name(), self.name)
elif self.name: elif self.name:
return self.name return self.name
......
...@@ -191,7 +191,12 @@ class StrategyModule(StrategyBase): ...@@ -191,7 +191,12 @@ class StrategyModule(StrategyBase):
if not callback_sent: if not callback_sent:
temp_task = task.copy() temp_task = task.copy()
temp_task.name = templar.template(temp_task.get_name(), fail_on_undefined=False) try:
temp_task.name = unicode(templar.template(temp_task.name, fail_on_undefined=False))
except:
# just ignore any errors during task name templating,
# we don't care if it just shows the raw name
pass
self._tqm.send_callback('v2_playbook_on_task_start', temp_task, is_conditional=False) self._tqm.send_callback('v2_playbook_on_task_start', temp_task, is_conditional=False)
callback_sent = True callback_sent = True
......
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