If someone use a task with a empty name like this:
- name:
command: true
This will result in displaying 'None' as a task name instead of
'command'.
... | ... |
@@ -26,7 +26,7 @@ from ansible.playbook.included_file import IncludedFile |
26 | 26 |
from ansible.plugins import action_loader |
27 | 27 |
from ansible.plugins.strategy import StrategyBase |
28 | 28 |
from ansible.template import Templar |
29 |
-from ansible.compat.six import text_type |
|
29 |
+from ansible.utils.unicode import to_unicode |
|
30 | 30 |
|
31 | 31 |
try: |
32 | 32 |
from __main__ import display |
... | ... |
@@ -109,7 +109,7 @@ class StrategyModule(StrategyBase): |
109 | 109 |
display.debug("done getting variables") |
110 | 110 |
|
111 | 111 |
try: |
112 |
- task.name = text_type(templar.template(task.name, fail_on_undefined=False)) |
|
112 |
+ task.name = to_unicode(templar.template(task.name, fail_on_undefined=False), nonstring='empty') |
|
113 | 113 |
display.debug("done templating") |
114 | 114 |
except: |
115 | 115 |
# just ignore any errors during task name templating, |
... | ... |
@@ -19,7 +19,7 @@ |
19 | 19 |
from __future__ import (absolute_import, division, print_function) |
20 | 20 |
__metaclass__ = type |
21 | 21 |
|
22 |
-from ansible.compat.six import iteritems, text_type |
|
22 |
+from ansible.compat.six import iteritems |
|
23 | 23 |
|
24 | 24 |
from ansible.errors import AnsibleError |
25 | 25 |
from ansible.executor.play_iterator import PlayIterator |
... | ... |
@@ -238,7 +238,7 @@ class StrategyModule(StrategyBase): |
238 | 238 |
saved_name = task.name |
239 | 239 |
display.debug("done copying, going to template now") |
240 | 240 |
try: |
241 |
- task.name = text_type(templar.template(task.name, fail_on_undefined=False)) |
|
241 |
+ task.name = to_unicode(templar.template(task.name, fail_on_undefined=False), nonstring='empty') |
|
242 | 242 |
display.debug("done templating") |
243 | 243 |
except: |
244 | 244 |
# just ignore any errors during task name templating, |