From df2712e3a16414acde21255f1e5a16383665feaa Mon Sep 17 00:00:00 2001 From: WadeStern Date: Fri, 21 Mar 2025 12:07:10 -0400 Subject: [PATCH 1/2] Modified get tasks to include task type. --- plugins/action/get_tasks.py | 4 ++-- plugins/action/restart_adapters.py | 2 +- tests/unit/test_input_action_module.py | 6 ++---- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/plugins/action/get_tasks.py b/plugins/action/get_tasks.py index 7a9d067..f33ec0d 100644 --- a/plugins/action/get_tasks.py +++ b/plugins/action/get_tasks.py @@ -4,7 +4,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later # Retrieves list of tasks from IAP. Supports filtering via parameters. -# Returns: List of task objects with their status and details. +# Returns: List of task objects with their status, details, and type. # Example: # - name: Get tasks by status # itential.platform.get_tasks: @@ -33,6 +33,6 @@ def run(self, tmp=None, task_vars=None): method = "GET" - params["include"] = "name,status" + params["include"] = "name,status,type" return make_request(task_vars, method, endpoint, params=params) diff --git a/plugins/action/restart_adapters.py b/plugins/action/restart_adapters.py index cfaaa30..8697e01 100644 --- a/plugins/action/restart_adapters.py +++ b/plugins/action/restart_adapters.py @@ -53,4 +53,4 @@ def run(self, tmp=None, task_vars=None): response = make_request(task_vars, method, endpoint) results.append(response) - return {"results": results} # Always return a list + return {"results": results} diff --git a/tests/unit/test_input_action_module.py b/tests/unit/test_input_action_module.py index 28aaf50..f5b8080 100644 --- a/tests/unit/test_input_action_module.py +++ b/tests/unit/test_input_action_module.py @@ -9,13 +9,11 @@ @pytest.mark.parametrize("action_module_class, input_args, expected_endpoint, expected_method, expected_params", [ (GetJobs, {"status": "running", "name": "greg"}, "/operations-manager/jobs", "GET", { "equals[status]": "running", - "equals[name]": "greg", - "include": "name,status" + "equals[name]": "greg" }), (GetTasks, {"status": "running", "name": "greg"}, "/operations-manager/tasks", "GET", { "equals[status]": "running", - "equals[name]": "greg", - "include": "name,status" + "equals[name]": "greg" }), ]) @patch("ansible_collections.itential.core.plugins.module_utils.http.send_request") From aa7e688fe0a9bccdd8ba62ce9c04f0c1967dda2c Mon Sep 17 00:00:00 2001 From: WadeStern Date: Fri, 21 Mar 2025 14:09:07 -0400 Subject: [PATCH 2/2] Fixed documentation --- plugins/action/get_tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/action/get_tasks.py b/plugins/action/get_tasks.py index f33ec0d..b12f3a2 100644 --- a/plugins/action/get_tasks.py +++ b/plugins/action/get_tasks.py @@ -3,7 +3,7 @@ # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) # SPDX-License-Identifier: GPL-3.0-or-later -# Retrieves list of tasks from IAP. Supports filtering via parameters. +# Retrieves list of tasks from Itential Platform. Supports filtering via parameters. # Returns: List of task objects with their status, details, and type. # Example: # - name: Get tasks by status