diff --git a/src/ansible_runner/__main__.py b/src/ansible_runner/__main__.py index 088ed8e9..8b04c324 100644 --- a/src/ansible_runner/__main__.py +++ b/src/ansible_runner/__main__.py @@ -45,6 +45,7 @@ from ansible_runner import output from ansible_runner import cleanup from ansible_runner._internal._dump_artifacts import dump_artifact +from ansible_runner.defaults import default_process_isolation_executable from ansible_runner.utils import Bunch, register_for_cleanup from ansible_runner.utils.capacity import get_cpu_count, get_mem_in_bytes, ensure_uuid from ansible_runner.utils.importlib_compat import importlib_metadata @@ -884,8 +885,8 @@ def main(sys_args=None): "project_dir": vargs.get('project_dir'), "artifact_dir": vargs.get('artifact_dir'), "roles_path": [vargs.get('roles_path')] if vargs.get('roles_path') else None, - "process_isolation": vargs.get('process_isolation'), - "process_isolation_executable": vargs.get('process_isolation_executable'), + "process_isolation": bool(vargs.get('process_isolation')), + "process_isolation_executable": vargs.get('process_isolation_executable') or default_process_isolation_executable, "process_isolation_path": vargs.get('process_isolation_path'), "process_isolation_hide_paths": vargs.get('process_isolation_hide_paths'), "process_isolation_show_paths": vargs.get('process_isolation_show_paths'), diff --git a/test/integration/test_transmit_worker_process.py b/test/integration/test_transmit_worker_process.py index a61ae660..54db2a3b 100644 --- a/test/integration/test_transmit_worker_process.py +++ b/test/integration/test_transmit_worker_process.py @@ -383,6 +383,25 @@ def worker_stream(transmit_stream, tmp_path): # pylint: disable=W0621 return ingoing_buffer +def test_transmit_role(tmp_path, cli, project_fixtures): + """When transmitting a role job via CLI, expect only 'playbook' in the job arguments. + + When we 'transmit' a role through the CLI command, we expect a playbook to be generated via + the role_manager(), which will in turn be transmitted as an artifact. No other parameters + are expected to be present. + """ + outgoing_buffer = tmp_path / 'buffer' + outgoing_buffer.touch() + + transmit_dir = project_fixtures / 'debug' + + r = cli(['transmit', str(transmit_dir), '--role', 'hello_world']) + data = json.loads(r.stdout.split('\n')[0]) + assert 'kwargs' in data + assert len(data['kwargs']) == 1 + assert 'playbook' in data['kwargs'] + + def test_worker_without_delete_no_dir(tmp_path, cli, transmit_stream): # pylint: disable=W0621 worker_dir = tmp_path / 'for_worker'