mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-30 06:11:26 -07:00
Remove shell module specialcases
Shell is implemented via the command module. There was a special case in mod_args to do that. Make shell into an action plugin to handle that instead. Also move the special case for the command nanny into a command module action plugin. This is more appropriate as we then do not have to send a parameter that is only for the command module to every single module.
This commit is contained in:
parent
39800e1390
commit
235bdfb996
8 changed files with 125 additions and 103 deletions
|
@ -23,13 +23,13 @@ from ansible.compat.tests import unittest
|
|||
from ansible.playbook.task import Task
|
||||
|
||||
|
||||
basic_shell_task = dict(
|
||||
basic_command_task = dict(
|
||||
name='Test Task',
|
||||
shell='echo hi'
|
||||
command='echo hi'
|
||||
)
|
||||
|
||||
kv_shell_task = dict(
|
||||
action='shell echo hi'
|
||||
kv_command_task = dict(
|
||||
action='command echo hi'
|
||||
)
|
||||
|
||||
|
||||
|
@ -54,20 +54,20 @@ class TestTask(unittest.TestCase):
|
|||
pass
|
||||
|
||||
def test_load_task_simple(self):
|
||||
t = Task.load(basic_shell_task)
|
||||
t = Task.load(basic_command_task)
|
||||
assert t is not None
|
||||
self.assertEqual(t.name, basic_shell_task['name'])
|
||||
self.assertEqual(t.name, basic_command_task['name'])
|
||||
self.assertEqual(t.action, 'command')
|
||||
self.assertEqual(t.args, dict(_raw_params='echo hi', _uses_shell=True))
|
||||
self.assertEqual(t.args, dict(_raw_params='echo hi'))
|
||||
|
||||
def test_load_task_kv_form(self):
|
||||
t = Task.load(kv_shell_task)
|
||||
t = Task.load(kv_command_task)
|
||||
self.assertEqual(t.action, 'command')
|
||||
self.assertEqual(t.args, dict(_raw_params='echo hi', _uses_shell=True))
|
||||
self.assertEqual(t.args, dict(_raw_params='echo hi'))
|
||||
|
||||
def test_task_auto_name(self):
|
||||
assert 'name' not in kv_shell_task
|
||||
t = Task.load(kv_shell_task)
|
||||
assert 'name' not in kv_command_task
|
||||
t = Task.load(kv_command_task)
|
||||
# self.assertEqual(t.name, 'shell echo hi')
|
||||
|
||||
def test_task_auto_name_with_role(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue