From 287f41f7313f363cc62283006d99efb70cf37596 Mon Sep 17 00:00:00 2001 From: WadeStern Date: Tue, 18 Mar 2025 13:27:01 -0400 Subject: [PATCH 1/8] Removed References to IAP, changed variable names to match deployer --- README.md | 44 +++++++++++------------ plugins/action/activate_job_worker.py | 2 +- plugins/action/activate_task_worker.py | 2 +- plugins/action/deactivate_job_worker.py | 2 +- plugins/action/deactivate_task_worker.py | 2 +- plugins/action/get_jobs.py | 2 +- plugins/action/get_system_health.py | 2 +- plugins/action/get_tasks.py | 2 +- plugins/action/get_worker_status.py | 2 +- plugins/action/restart_adapters.py | 4 +-- plugins/action/restart_applications.py | 10 +++--- plugins/module_utils/host.py | 38 ++++++++++---------- plugins/module_utils/request.py | 12 +++---- plugins/modules/activate_job_worker.py | 6 ++-- plugins/modules/activate_task_worker.py | 6 ++-- plugins/modules/auth_token.py | 4 +-- plugins/modules/deactivate_job_worker.py | 6 ++-- plugins/modules/deactivate_task_worker.py | 6 ++-- plugins/modules/generic_request.py | 6 ++-- plugins/modules/get_jobs.py | 4 +-- plugins/modules/get_system_health.py | 10 +++--- plugins/modules/get_tasks.py | 4 +-- plugins/modules/get_worker_status.py | 4 +-- plugins/modules/restart_adapters.py | 6 ++-- plugins/modules/restart_applications.py | 12 +++---- tests/unit/test_request.py | 2 +- 26 files changed, 99 insertions(+), 101 deletions(-) diff --git a/README.md b/README.md index d750521..649ca08 100644 --- a/README.md +++ b/README.md @@ -32,75 +32,75 @@ export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES ## Available Modules ### Job Worker Management -- **activate_job_worker**: Activate the job worker for an IAP system +- **activate_job_worker**: Activate the job worker for a Platform system ```yaml - - name: Activate IAP job worker + - name: Activate Platform job worker itential.platform.activate_job_worker: ``` -- **deactivate_job_worker**: Deactivate the job worker for an IAP system +- **deactivate_job_worker**: Deactivate the job worker for a Platform system ```yaml - - name: Deactivate IAP job worker + - name: Deactivate Platform job worker itential.platform.deactivate_job_worker: ``` ### Task Worker Management -- **activate_task_worker**: Activate the task worker for an IAP system +- **activate_task_worker**: Activate the task worker for a Platform system ```yaml - - name: Activate IAP task worker + - name: Activate Platform task worker itential.platform.activate_task_worker: ``` -- **deactivate_task_worker**: Deactivate the task worker for an IAP system +- **deactivate_task_worker**: Deactivate the task worker for a Platform system ```yaml - - name: Deactivate IAP task worker + - name: Deactivate Platform task worker itential.platform.deactivate_task_worker: ``` ### System Information -- **get_system_health**: Retrieve the health status of an IAP system +- **get_system_health**: Retrieve the health status of a Platform system ```yaml - - name: Get IAP system health + - name: Get Platform system health itential.platform.get_system_health: ``` -- **get_worker_status**: Get the current status of IAP workers +- **get_worker_status**: Get the current status of Platform workers ```yaml - - name: Get IAP worker status + - name: Get Platform worker status itential.platform.get_worker_status: ``` ### Job and Task Management -- **get_jobs**: Retrieve a list of jobs from an IAP system +- **get_jobs**: Retrieve a list of jobs from a Platform system ```yaml - - name: Get IAP jobs + - name: Get Platform jobs itential.platform.get_jobs: ``` -- **get_tasks**: Retrieve a list of tasks from an IAP system +- **get_tasks**: Retrieve a list of tasks from a Platform system ```yaml - - name: Get IAP tasks + - name: Get Platform tasks itential.platform.get_tasks: ``` ### System Administration -- **restart_adapter**: Restart a specific adapter in the IAP system +- **restart_adapter**: Restart a specific adapter in the Platform system ```yaml - - name: Restart IAP adapter + - name: Restart Platform adapter itential.platform.restart_adapter: adapter_name: "my-adapter" ``` -- **restart_application**: Restart the IAP application +- **restart_application**: Restart the Platform application ```yaml - - name: Restart IAP application + - name: Restart Platform application itential.platform.restart_application: ``` ### Connection Parameters Each module requires the following connection parameters which can be defined in your Ansible environment: -- `host`: The hostname or IP of the IAP instance -- `port`: The port number for the IAP API +- `host`: The hostname or IP of the Platform instance +- `port`: The port number for the Platform API - `use_tls`: Whether to use HTTPS (default: true) - `verify`: Whether to verify SSL certificates (default: true) - `disable_warnings`: Whether to disable SSL warning messages (default: false) diff --git a/plugins/action/activate_job_worker.py b/plugins/action/activate_job_worker.py index 35b2861..c616f23 100644 --- a/plugins/action/activate_job_worker.py +++ b/plugins/action/activate_job_worker.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 -# Activates the IAP job worker. No parameters required. +# Activates the Platform job worker. No parameters required. # Example: # - name: Activate job worker # itential.platform.activate_job_worker: diff --git a/plugins/action/activate_task_worker.py b/plugins/action/activate_task_worker.py index 96462db..e8dda52 100644 --- a/plugins/action/activate_task_worker.py +++ b/plugins/action/activate_task_worker.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 -# Activates the IAP task worker. No parameters required. +# Activates the Platform task worker. No parameters required. # Example: # - name: Activate task worker # itential.platform.activate_task_worker: diff --git a/plugins/action/deactivate_job_worker.py b/plugins/action/deactivate_job_worker.py index 45b6bbc..20e684c 100644 --- a/plugins/action/deactivate_job_worker.py +++ b/plugins/action/deactivate_job_worker.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 -# Deactivates the IAP job worker. No parameters required. +# Deactivates the Platform job worker. No parameters required. # Example: # - name: Deactivate job worker # itential.platform.deactivate_job_worker: diff --git a/plugins/action/deactivate_task_worker.py b/plugins/action/deactivate_task_worker.py index c84fa1f..a38cc8a 100644 --- a/plugins/action/deactivate_task_worker.py +++ b/plugins/action/deactivate_task_worker.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 -# Deactivates the IAP task worker. No parameters required. +# Deactivates the Platform task worker. No parameters required. # Example: # - name: Deactivate task worker # itential.platform.deactivate_task_worker: diff --git a/plugins/action/get_jobs.py b/plugins/action/get_jobs.py index e54b4dd..2d824c7 100644 --- a/plugins/action/get_jobs.py +++ b/plugins/action/get_jobs.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 jobs from IAP. No parameters required. +# Retrieves list of jobs from Platform. No parameters required. # Returns: List of job objects with their status and details. # Example: # - name: Get all jobs diff --git a/plugins/action/get_system_health.py b/plugins/action/get_system_health.py index d031cc5..bea0f68 100644 --- a/plugins/action/get_system_health.py +++ b/plugins/action/get_system_health.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 IAP system health status. No parameters required. +# Retrieves Platform system health status. No parameters required. # Returns: System health information including component statuses. # Example: # - name: Get system health diff --git a/plugins/action/get_tasks.py b/plugins/action/get_tasks.py index 7a9d067..47b66c2 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 Platform. Supports filtering via parameters. # Returns: List of task objects with their status and details. # Example: # - name: Get tasks by status diff --git a/plugins/action/get_worker_status.py b/plugins/action/get_worker_status.py index 990c21c..a4441ae 100644 --- a/plugins/action/get_worker_status.py +++ b/plugins/action/get_worker_status.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 status of all IAP workers. No parameters required. +# Retrieves status of all Platform workers. No parameters required. # Returns: Status information for job and task workers. # Example: # - name: Get worker status diff --git a/plugins/action/restart_adapters.py b/plugins/action/restart_adapters.py index cfaaa30..e92b2a9 100644 --- a/plugins/action/restart_adapters.py +++ b/plugins/action/restart_adapters.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 -# Restarts one or more IAP adapters. +# Restarts one or more Platform adapters. # Parameters: # adapter_names: A single adapter name (str) or a list of adapter names (list). # @@ -34,7 +34,7 @@ class ActionModule(ActionBase): _requires_connection = False def run(self, tmp=None, task_vars=None): - """Restart one or more IAP adapters by making API requests.""" + """Restart one or more Platform adapters by making API requests.""" adapter_names = self._task.args.get("adapter_names") if not adapter_names: diff --git a/plugins/action/restart_applications.py b/plugins/action/restart_applications.py index f64aa00..c4faec3 100644 --- a/plugins/action/restart_applications.py +++ b/plugins/action/restart_applications.py @@ -3,24 +3,24 @@ # 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 -# Restarts one or more IAP applications. +# Restarts one or more Platform applications. # Parameters: # application_names: A single application name (str) or a list of application names (list). # # Examples: # - name: Restart a single application (string input) # itential.platform.restart_application: -# application_names: "iap-core" +# application_names: "platform-core" # # - name: Restart a single application (list input) # itential.platform.restart_application: # application_names: -# - iap-core +# - platform-core # # - name: Restart multiple applications # itential.platform.restart_application: # application_names: -# - iap-core +# - platform-core # - ag-manager from ansible.plugins.action import ActionBase @@ -34,7 +34,7 @@ class ActionModule(ActionBase): _requires_connection = False def run(self, tmp=None, task_vars=None): - """Restart one or more IAP applications by making API requests.""" + """Restart one or more Platform applications by making API requests.""" application_names = self._task.args.get("application_names") if not application_names: diff --git a/plugins/module_utils/host.py b/plugins/module_utils/host.py index 58433bc..3085a89 100644 --- a/plugins/module_utils/host.py +++ b/plugins/module_utils/host.py @@ -22,17 +22,17 @@ type: str required: true vars: - - itential_host - ansible_host port: description: - The port used to connect to the remote host type: int + default: 3000 vars: - - itential_port - - ansible_port - - iap_port + - platform_port + - platform_http_port + - platform_https_port username: description: @@ -41,9 +41,8 @@ vars: - itential_http_user - itential_user - - ansible_user - - iap_username - - iap_user + - platform_username + - platform_user password: description: @@ -52,38 +51,37 @@ vars: - itential_http_password - itential_password - - ansible_password - - iap_password - - iap_pass + - platform_password + - platform_pass - iap_auth_token: + platform_auth_token: description: - - The authentication token to use for IAP requests (optional) + - The authentication token to use for Platform requests (optional) type: str vars: - - iap_auth_token + - platform_auth_token use_tls: description: - Enable or disable the use of TLS for the connection type: bool - default: true + default: false vars: - - itential_http_use_tls + - platform_https headers: description: - The set of key/value pairs to include in the header on every request type: dict vars: - - intential_http_headers + - platform_http_headers base_path: description: - The API base path to prepend for every request type: str vars: - - itential_http_base_path + - platform_http_base_path auth_type: description: @@ -91,7 +89,7 @@ type: str choices: [ "basic", "token" ] vars: - - itential_http_auth_type + - platform_http_auth_type verify: description: @@ -99,7 +97,7 @@ type: bool default: true vars: - - itential_http_verify + - platform_http_verify disable_warnings: description: @@ -107,5 +105,5 @@ type: bool default: false vars: - - itential_http_disable_warnings + - platform_http_disable_warnings """ diff --git a/plugins/module_utils/request.py b/plugins/module_utils/request.py index 50178da..f3340ec 100644 --- a/plugins/module_utils/request.py +++ b/plugins/module_utils/request.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 -# This module provides a function to send authenticated API requests to the Itential Automation Platform (IAP). +# This module provides a function to send authenticated API requests to the Itential Platform (Platform). # It handles: # - Constructing the API request with proper authentication. # - Validating request parameters such as HTTP method, JSON data, and URL format. @@ -11,7 +11,7 @@ # - Processing the API response, ensuring it contains valid JSON when applicable. # - Logging request and response details for debugging. # -# The function `make_request()` is used by Ansible modules to interact with IAP. +# The function `make_request()` is used by Ansible modules to interact with Platform. import json import time @@ -64,15 +64,15 @@ def make_request(task_vars, method, endpoint, params=None, data=None): if not re.match(r"^https?://[^\s/$.?#].[^\s]*$", url): raise AnsibleError(f"Malformed URL: {url}") - # Check if iap_auth_token is provided in task vars - auth_token = hostvars.get("iap_auth_token") + # Check if platform_auth_token is provided in task vars + auth_token = hostvars.get("platform_auth_token") # If auth_token is already provided, add it to params. Otherwise, call the login function if auth_token: - display.vvv("Using Provided IAP Auth Token") + display.vvv("Using Provided Platform Auth Token") params["token"] = auth_token else: - display.vvv("Generating new IAP Auth Token") + display.vvv("Generating new Platform Auth Token") params["token"] = login(host) display.vvv( diff --git a/plugins/modules/activate_job_worker.py b/plugins/modules/activate_job_worker.py index 26fe832..2240bea 100644 --- a/plugins/modules/activate_job_worker.py +++ b/plugins/modules/activate_job_worker.py @@ -13,15 +13,15 @@ module: itential.platform.activate_job_worker author: Itential -short_description: Activate the job worker for an IAP system +short_description: Activate the job worker for a Platform system description: - The M(itential.platform.activate_job_worker) module activates a - job worker for an IAP system. + job worker for a Platform system. """ EXAMPLES = """ - - name: activate iap job worker + - name: activate platform job worker itential.platform.activate_job_worker: """ diff --git a/plugins/modules/activate_task_worker.py b/plugins/modules/activate_task_worker.py index ad3483d..855f3b3 100644 --- a/plugins/modules/activate_task_worker.py +++ b/plugins/modules/activate_task_worker.py @@ -13,15 +13,15 @@ module: itential.platform.activate_task_worker author: Itential -short_description: Activate the task worker for an IAP system +short_description: Activate the task worker for a Platform system description: - The M(itential.platform.activate_task_worker) module activates a - task worker for an IAP system. + task worker for a Platform system. """ EXAMPLES = """ - - name: activate iap task worker + - name: activate platform task worker itential.platform.activate_task_worker: """ diff --git a/plugins/modules/auth_token.py b/plugins/modules/auth_token.py index d0748ea..35075de 100644 --- a/plugins/modules/auth_token.py +++ b/plugins/modules/auth_token.py @@ -13,10 +13,10 @@ module: itential.platform.auth_token author: Itential -short_description: Generate an authentication token for IAP. +short_description: Generate an authentication token for Platform. description: - - The M(itential.platform.auth_token) module generates an authentication token for an IAP system. + - The M(itential.platform.auth_token) module generates an authentication token for a Platform system. - This token can be used to authenticate API requests within the platform. - The module does not require any input parameters. diff --git a/plugins/modules/deactivate_job_worker.py b/plugins/modules/deactivate_job_worker.py index 259996a..c7d99ff 100644 --- a/plugins/modules/deactivate_job_worker.py +++ b/plugins/modules/deactivate_job_worker.py @@ -13,15 +13,15 @@ module: itential.platform.deactivate_job_worker author: Itential -short_description: deactivate the job worker for an IAP system +short_description: deactivate the job worker for a Platform system description: - The M(itential.platform.deactivate_job_worker) module deactivates a - job worker for an IAP system. + job worker for a Platform system. """ EXAMPLES = """ - - name: deactivate iap job worker + - name: deactivate platform job worker itential.platform.deactivate_job_worker: """ diff --git a/plugins/modules/deactivate_task_worker.py b/plugins/modules/deactivate_task_worker.py index a210b08..63e6873 100644 --- a/plugins/modules/deactivate_task_worker.py +++ b/plugins/modules/deactivate_task_worker.py @@ -13,15 +13,15 @@ module: itential.platform.deactivate_task_worker author: Itential -short_description: deactivate the task worker for an IAP system +short_description: deactivate the task worker for a Platform system description: - The M(itential.platform.deactivate_task_worker) module deactivates a - task worker for an IAP system. + task worker for a Platform system. """ EXAMPLES = """ - - name: deactivate iap task worker + - name: deactivate platform task worker itential.platform.deactivate_task_worker: """ diff --git a/plugins/modules/generic_request.py b/plugins/modules/generic_request.py index fd16a8b..bd47ab0 100644 --- a/plugins/modules/generic_request.py +++ b/plugins/modules/generic_request.py @@ -13,12 +13,12 @@ module: itential.platform.api_request author: Itential -short_description: Send a generic API request to an IAP system. +short_description: Send a generic API request to a Platform system. description: - - The M(itential.platform.api_request) module allows users to send generic API requests to an IAP system. + - The M(itential.platform.api_request) module allows users to send generic API requests to a Platform system. - It supports specifying the HTTP method, endpoint, query parameters, and request body data. - - This module is useful for interacting with various IAP API endpoints without creating dedicated modules. + - This module is useful for interacting with various Platform API endpoints without creating dedicated modules. options: method: diff --git a/plugins/modules/get_jobs.py b/plugins/modules/get_jobs.py index dbb0cdf..b7875c4 100644 --- a/plugins/modules/get_jobs.py +++ b/plugins/modules/get_jobs.py @@ -13,10 +13,10 @@ module: itential.platform.get_jobs author: Itential -short_description: Retrieve a list of jobs from an IAP system with optional filtering. +short_description: Retrieve a list of jobs from a Platform system with optional filtering. description: - - The M(itential.platform.get_jobs) module retrieves a list of jobs from an IAP system. + - The M(itential.platform.get_jobs) module retrieves a list of jobs from a Platform system. - Users can provide key-value pairs as arguments to filter the results based on job attributes. - Filters are dynamically converted to query parameters, allowing for flexible job retrieval. - The response includes the job name and status by default. diff --git a/plugins/modules/get_system_health.py b/plugins/modules/get_system_health.py index 7dce623..0879fbd 100644 --- a/plugins/modules/get_system_health.py +++ b/plugins/modules/get_system_health.py @@ -10,18 +10,18 @@ DOCUMENTATION = """ --- -module: itential.iap.get_system_health +module: itential.platform.get_system_health author: Itential -short_description: Get the health of an IAP system +short_description: Get the health of a Platform system description: - - The M(itential.iap.get_system_health) module returns the health of the - IAP system. + - The M(itential.platform.get_system_health) module returns the health of the + Platform system. """ EXAMPLES = """ - name: get the health of a system - itential.iap.get_system_health: + itential.platform.get_system_health: """ diff --git a/plugins/modules/get_tasks.py b/plugins/modules/get_tasks.py index 287dc06..55490de 100644 --- a/plugins/modules/get_tasks.py +++ b/plugins/modules/get_tasks.py @@ -13,10 +13,10 @@ module: itential.platform.get_tasks author: Itential -short_description: Retrieve a list of tasks from an IAP system with optional filtering. +short_description: Retrieve a list of tasks from a Platform system with optional filtering. description: - - The M(itential.platform.get_tasks) module retrieves a list of tasks from an IAP system. + - The M(itential.platform.get_tasks) module retrieves a list of tasks from a Platform system. - Users can provide key-value pairs as arguments to filter the results based on task attributes. - Filters are dynamically converted to query parameters, allowing for flexible task retrieval. - The response includes the task name and status by default. diff --git a/plugins/modules/get_worker_status.py b/plugins/modules/get_worker_status.py index 8b08b52..d3b4b68 100644 --- a/plugins/modules/get_worker_status.py +++ b/plugins/modules/get_worker_status.py @@ -13,11 +13,11 @@ module: itential.platform.get_worker_status author: Itential -short_description: Get the worker status from an IAP system +short_description: Get the worker status from a Platform system description: - The M(itential.platform.get_worker_status) module returns the status of job - and task workers from an IAP system. + and task workers from a Platform system. """ diff --git a/plugins/modules/restart_adapters.py b/plugins/modules/restart_adapters.py index 0a23654..9a2aabc 100644 --- a/plugins/modules/restart_adapters.py +++ b/plugins/modules/restart_adapters.py @@ -13,12 +13,12 @@ module: itential.platform.restart_adapters author: Itential -short_description: Restart one or more adapters in the IAP system. +short_description: Restart one or more adapters in the Platform system. description: - The M(itential.platform.restart_adapters) module restarts one or more adapters in the - IAP system using the names provided via the C(adapter_names) argument. - - This module communicates with the IAP API to perform the restart operation. + Platform system using the names provided via the C(adapter_names) argument. + - This module communicates with the Platform API to perform the restart operation. - The C(adapter_names) parameter supports both a single adapter name (as a string) and multiple adapter names (as a list). options: diff --git a/plugins/modules/restart_applications.py b/plugins/modules/restart_applications.py index 0399905..531cac1 100644 --- a/plugins/modules/restart_applications.py +++ b/plugins/modules/restart_applications.py @@ -13,12 +13,12 @@ module: itential.platform.restart_applications author: Itential -short_description: Restart one or more applications in the IAP system. +short_description: Restart one or more applications in the Platform system. description: - The M(itential.platform.restart_applications) module restarts one or more applications in the - IAP system using the names provided via the C(application_names) argument. - - This module communicates with the IAP API to perform the restart operation. + Platform system using the names provided via the C(application_names) argument. + - This module communicates with the Platform API to perform the restart operation. - The C(application_names) parameter supports both a single application name (as a string) and multiple application names (as a list). options: @@ -33,19 +33,19 @@ EXAMPLES = """ - name: Restart a single application (string input) itential.platform.restart_applications: - application_names: iap-core + application_names: OperationsManager delegate_to: localhost - name: Restart a single application (list input) itential.platform.restart_applications: application_names: - - iap-core + - OperationsManager delegate_to: localhost - name: Restart multiple applications itential.platform.restart_applications: application_names: - - iap-core + - OperationsManager - ag-manager delegate_to: localhost """ diff --git a/tests/unit/test_request.py b/tests/unit/test_request.py index 6673949..d3b511a 100644 --- a/tests/unit/test_request.py +++ b/tests/unit/test_request.py @@ -67,7 +67,7 @@ def test_make_request_with_manual_token(mock_login, mock_http_request, mock_task manual_token = "manual-token" # Add the manual token to the existing mock_task_vars - mock_task_vars["hostvars"]["platform"]["iap_auth_token"] = manual_token + mock_task_vars["hostvars"]["platform"]["platform_auth_token"] = manual_token # Mock HTTP response api_response = MagicMock(status_code=200, text=json.dumps({"key": "value"})) From c2cde5963be1ce79a89fdc9dbdb3ba9335251f17 Mon Sep 17 00:00:00 2001 From: WadeStern Date: Tue, 18 Mar 2025 13:38:55 -0400 Subject: [PATCH 2/8] Got rid of default port --- plugins/module_utils/host.py | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/module_utils/host.py b/plugins/module_utils/host.py index 3085a89..9875fd6 100644 --- a/plugins/module_utils/host.py +++ b/plugins/module_utils/host.py @@ -28,7 +28,6 @@ description: - The port used to connect to the remote host type: int - default: 3000 vars: - platform_port - platform_http_port From 602cf05e74271f6244dce9015b1d661fdc642a4a Mon Sep 17 00:00:00 2001 From: WadeStern Date: Tue, 18 Mar 2025 13:53:00 -0400 Subject: [PATCH 3/8] Cleaned up login and added a debug --- plugins/module_utils/login.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/plugins/module_utils/login.py b/plugins/module_utils/login.py index 81e1864..d47bf08 100644 --- a/plugins/module_utils/login.py +++ b/plugins/module_utils/login.py @@ -4,14 +4,8 @@ # SPDX-License-Identifier: GPL-3.0-or-later import json - -from functools import partial - from ansible.errors import AnsibleError - from ansible_collections.itential.core.plugins.module_utils import display -from ansible_collections.itential.core.plugins.module_utils import hosts - from ansible_collections.itential.core.plugins.module_utils import http def login(host): @@ -32,6 +26,7 @@ def login(host): url = http.make_url(host.host, "/login", port=host.port, use_tls=host.use_tls) data = json.dumps({"user": user}).encode("utf-8") + display.v(f"Request URL: {url}") display.v(type(data)) try: From b0d76d0a5623d477af2086b1235728a89ce4c3ad Mon Sep 17 00:00:00 2001 From: WadeStern Date: Tue, 18 Mar 2025 16:14:48 -0400 Subject: [PATCH 4/8] Added documentation to the login module util --- plugins/module_utils/login.py | 11 +++++++++++ plugins/module_utils/request.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/module_utils/login.py b/plugins/module_utils/login.py index d47bf08..efe9be0 100644 --- a/plugins/module_utils/login.py +++ b/plugins/module_utils/login.py @@ -3,6 +3,17 @@ # 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 +# This module provides a function to authenticate with the Itential Platform API. +# It handles: +# - Constructing a login request with the proper URL, headers, and JSON-encoded credentials. +# - Validating required properties (username and password) before sending the request. +# - Sending a POST request to the Platform's `/login` endpoint using TLS or non-TLS based on the host object. +# - Handling exceptions, including missing credentials, connection issues, and unexpected HTTP responses. +# - Returning the authentication token or response text if the login is successful. +# - Logging request details (URL and payload type) for debugging purposes. +# +# The function `login()` is used by Ansible modules and utilities to retrieve authentication tokens for subsequent API requests. + import json from ansible.errors import AnsibleError from ansible_collections.itential.core.plugins.module_utils import display diff --git a/plugins/module_utils/request.py b/plugins/module_utils/request.py index f3340ec..1e23bfb 100644 --- a/plugins/module_utils/request.py +++ b/plugins/module_utils/request.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 -# This module provides a function to send authenticated API requests to the Itential Platform (Platform). +# This module provides a function to send authenticated API requests to the Itential Platform. # It handles: # - Constructing the API request with proper authentication. # - Validating request parameters such as HTTP method, JSON data, and URL format. From ecdc313f1651214af4a31069fd5fca10262a7fe4 Mon Sep 17 00:00:00 2001 From: WadeStern Date: Wed, 19 Mar 2025 14:36:38 -0400 Subject: [PATCH 5/8] Changed references to "Platform" in the documentation to "Itential Platform" for clarity. --- README.md | 24 +++++++++++------------ plugins/action/activate_job_worker.py | 2 +- plugins/action/activate_task_worker.py | 2 +- plugins/action/deactivate_job_worker.py | 2 +- plugins/action/deactivate_task_worker.py | 2 +- plugins/action/get_jobs.py | 2 +- plugins/action/get_system_health.py | 2 +- plugins/action/get_tasks.py | 2 +- plugins/action/get_worker_status.py | 2 +- plugins/action/restart_adapters.py | 4 ++-- plugins/action/restart_applications.py | 6 +++--- plugins/module_utils/host.py | 2 +- plugins/module_utils/login.py | 9 ++++++--- plugins/module_utils/request.py | 9 +++++---- plugins/modules/activate_job_worker.py | 4 ++-- plugins/modules/activate_task_worker.py | 4 ++-- plugins/modules/auth_token.py | 5 +++-- plugins/modules/deactivate_job_worker.py | 4 ++-- plugins/modules/deactivate_task_worker.py | 4 ++-- plugins/modules/generic_request.py | 8 +++++--- plugins/modules/get_jobs.py | 5 +++-- plugins/modules/get_system_health.py | 4 ++-- plugins/modules/get_tasks.py | 6 ++++-- plugins/modules/get_worker_status.py | 4 ++-- plugins/modules/restart_adapters.py | 9 +++++---- plugins/modules/restart_applications.py | 9 +++++---- 26 files changed, 74 insertions(+), 62 deletions(-) diff --git a/README.md b/README.md index 649ca08..4079efc 100644 --- a/README.md +++ b/README.md @@ -32,66 +32,66 @@ export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES ## Available Modules ### Job Worker Management -- **activate_job_worker**: Activate the job worker for a Platform system +- **activate_job_worker**: Activate the job worker for an Itential Platform system ```yaml - name: Activate Platform job worker itential.platform.activate_job_worker: ``` -- **deactivate_job_worker**: Deactivate the job worker for a Platform system +- **deactivate_job_worker**: Deactivate the job worker for an Itential Platform system ```yaml - name: Deactivate Platform job worker itential.platform.deactivate_job_worker: ``` ### Task Worker Management -- **activate_task_worker**: Activate the task worker for a Platform system +- **activate_task_worker**: Activate the task worker for an Itential Platform system ```yaml - name: Activate Platform task worker itential.platform.activate_task_worker: ``` -- **deactivate_task_worker**: Deactivate the task worker for a Platform system +- **deactivate_task_worker**: Deactivate the task worker for an Itential Platform system ```yaml - name: Deactivate Platform task worker itential.platform.deactivate_task_worker: ``` ### System Information -- **get_system_health**: Retrieve the health status of a Platform system +- **get_system_health**: Retrieve the health status of an Itential Platform system ```yaml - name: Get Platform system health itential.platform.get_system_health: ``` -- **get_worker_status**: Get the current status of Platform workers +- **get_worker_status**: Get the current status of Itential Platform workers ```yaml - name: Get Platform worker status itential.platform.get_worker_status: ``` ### Job and Task Management -- **get_jobs**: Retrieve a list of jobs from a Platform system +- **get_jobs**: Retrieve a list of jobs from an Itential Platform system ```yaml - name: Get Platform jobs itential.platform.get_jobs: ``` -- **get_tasks**: Retrieve a list of tasks from a Platform system +- **get_tasks**: Retrieve a list of tasks from an Itential Platform system ```yaml - name: Get Platform tasks itential.platform.get_tasks: ``` ### System Administration -- **restart_adapter**: Restart a specific adapter in the Platform system +- **restart_adapter**: Restart a specific adapter in the Itential Platform system ```yaml - name: Restart Platform adapter itential.platform.restart_adapter: adapter_name: "my-adapter" ``` -- **restart_application**: Restart the Platform application +- **restart_application**: Restart the Itential Platform application ```yaml - name: Restart Platform application itential.platform.restart_application: @@ -99,8 +99,8 @@ export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES ### Connection Parameters Each module requires the following connection parameters which can be defined in your Ansible environment: -- `host`: The hostname or IP of the Platform instance -- `port`: The port number for the Platform API +- `host`: The hostname or IP of the Itential Platform instance +- `port`: The port number for the Itential Platform API - `use_tls`: Whether to use HTTPS (default: true) - `verify`: Whether to verify SSL certificates (default: true) - `disable_warnings`: Whether to disable SSL warning messages (default: false) diff --git a/plugins/action/activate_job_worker.py b/plugins/action/activate_job_worker.py index c616f23..78668e5 100644 --- a/plugins/action/activate_job_worker.py +++ b/plugins/action/activate_job_worker.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 -# Activates the Platform job worker. No parameters required. +# Activates the Itential Platform job worker. No parameters required. # Example: # - name: Activate job worker # itential.platform.activate_job_worker: diff --git a/plugins/action/activate_task_worker.py b/plugins/action/activate_task_worker.py index e8dda52..80c8932 100644 --- a/plugins/action/activate_task_worker.py +++ b/plugins/action/activate_task_worker.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 -# Activates the Platform task worker. No parameters required. +# Activates the Itential Platform task worker. No parameters required. # Example: # - name: Activate task worker # itential.platform.activate_task_worker: diff --git a/plugins/action/deactivate_job_worker.py b/plugins/action/deactivate_job_worker.py index 20e684c..8d04511 100644 --- a/plugins/action/deactivate_job_worker.py +++ b/plugins/action/deactivate_job_worker.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 -# Deactivates the Platform job worker. No parameters required. +# Deactivates the Itential Platform job worker. No parameters required. # Example: # - name: Deactivate job worker # itential.platform.deactivate_job_worker: diff --git a/plugins/action/deactivate_task_worker.py b/plugins/action/deactivate_task_worker.py index a38cc8a..648acc4 100644 --- a/plugins/action/deactivate_task_worker.py +++ b/plugins/action/deactivate_task_worker.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 -# Deactivates the Platform task worker. No parameters required. +# Deactivates the Itential Platform task worker. No parameters required. # Example: # - name: Deactivate task worker # itential.platform.deactivate_task_worker: diff --git a/plugins/action/get_jobs.py b/plugins/action/get_jobs.py index 2d824c7..5cf9251 100644 --- a/plugins/action/get_jobs.py +++ b/plugins/action/get_jobs.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 jobs from Platform. No parameters required. +# Retrieves list of jobs from Itential Platform. No parameters required. # Returns: List of job objects with their status and details. # Example: # - name: Get all jobs diff --git a/plugins/action/get_system_health.py b/plugins/action/get_system_health.py index bea0f68..c183e63 100644 --- a/plugins/action/get_system_health.py +++ b/plugins/action/get_system_health.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 Platform system health status. No parameters required. +# Retrieves the Itential Platform system health status. No parameters required. # Returns: System health information including component statuses. # Example: # - name: Get system health diff --git a/plugins/action/get_tasks.py b/plugins/action/get_tasks.py index 47b66c2..36cf4d7 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 Platform. Supports filtering via parameters. +# Retrieves list of tasks from Itential Platform. Supports filtering via parameters. # Returns: List of task objects with their status and details. # Example: # - name: Get tasks by status diff --git a/plugins/action/get_worker_status.py b/plugins/action/get_worker_status.py index a4441ae..bafa0f8 100644 --- a/plugins/action/get_worker_status.py +++ b/plugins/action/get_worker_status.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 status of all Platform workers. No parameters required. +# Retrieves status of all Itential Platform workers. No parameters required. # Returns: Status information for job and task workers. # Example: # - name: Get worker status diff --git a/plugins/action/restart_adapters.py b/plugins/action/restart_adapters.py index e92b2a9..e71e1c6 100644 --- a/plugins/action/restart_adapters.py +++ b/plugins/action/restart_adapters.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 -# Restarts one or more Platform adapters. +# Restarts one or more Itential Platform adapters. # Parameters: # adapter_names: A single adapter name (str) or a list of adapter names (list). # @@ -34,7 +34,7 @@ class ActionModule(ActionBase): _requires_connection = False def run(self, tmp=None, task_vars=None): - """Restart one or more Platform adapters by making API requests.""" + """Restart one or more Itential Platform adapters by making API requests.""" adapter_names = self._task.args.get("adapter_names") if not adapter_names: diff --git a/plugins/action/restart_applications.py b/plugins/action/restart_applications.py index c4faec3..d5d57d7 100644 --- a/plugins/action/restart_applications.py +++ b/plugins/action/restart_applications.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 -# Restarts one or more Platform applications. +# Restarts one or more Itential Platform applications. # Parameters: # application_names: A single application name (str) or a list of application names (list). # @@ -34,7 +34,7 @@ class ActionModule(ActionBase): _requires_connection = False def run(self, tmp=None, task_vars=None): - """Restart one or more Platform applications by making API requests.""" + """Restart one or more Itential Platform applications by making API requests.""" application_names = self._task.args.get("application_names") if not application_names: @@ -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/plugins/module_utils/host.py b/plugins/module_utils/host.py index 9875fd6..78269e4 100644 --- a/plugins/module_utils/host.py +++ b/plugins/module_utils/host.py @@ -55,7 +55,7 @@ platform_auth_token: description: - - The authentication token to use for Platform requests (optional) + - The authentication token to use for Itential Platform requests (optional) type: str vars: - platform_auth_token diff --git a/plugins/module_utils/login.py b/plugins/module_utils/login.py index efe9be0..fecce08 100644 --- a/plugins/module_utils/login.py +++ b/plugins/module_utils/login.py @@ -7,12 +7,15 @@ # It handles: # - Constructing a login request with the proper URL, headers, and JSON-encoded credentials. # - Validating required properties (username and password) before sending the request. -# - Sending a POST request to the Platform's `/login` endpoint using TLS or non-TLS based on the host object. -# - Handling exceptions, including missing credentials, connection issues, and unexpected HTTP responses. +# - Sending a POST request to the Itential Platform's `/login` endpoint using TLS or non-TLS +# based on the host object. +# - Handling exceptions, including missing credentials, connection issues, and unexpected +# HTTP responses. # - Returning the authentication token or response text if the login is successful. # - Logging request details (URL and payload type) for debugging purposes. # -# The function `login()` is used by Ansible modules and utilities to retrieve authentication tokens for subsequent API requests. +# The function `login()` is used by Ansible modules and utilities to retrieve authentication +# tokens for subsequent API requests. import json from ansible.errors import AnsibleError diff --git a/plugins/module_utils/request.py b/plugins/module_utils/request.py index 1e23bfb..aaf8845 100644 --- a/plugins/module_utils/request.py +++ b/plugins/module_utils/request.py @@ -7,11 +7,12 @@ # It handles: # - Constructing the API request with proper authentication. # - Validating request parameters such as HTTP method, JSON data, and URL format. -# - Sending the request and handling various exceptions, including connection errors, timeouts, and HTTP failures. +# - Sending the request and handling various exceptions, including connection errors, timeouts, and +# HTTP failures. # - Processing the API response, ensuring it contains valid JSON when applicable. # - Logging request and response details for debugging. # -# The function `make_request()` is used by Ansible modules to interact with Platform. +# The function `make_request()` is used by Ansible modules to interact with Itential Platform. import json import time @@ -69,10 +70,10 @@ def make_request(task_vars, method, endpoint, params=None, data=None): # If auth_token is already provided, add it to params. Otherwise, call the login function if auth_token: - display.vvv("Using Provided Platform Auth Token") + display.vvv("Using Provided Itential Platform Auth Token") params["token"] = auth_token else: - display.vvv("Generating new Platform Auth Token") + display.vvv("Generating new Itential Platform Auth Token") params["token"] = login(host) display.vvv( diff --git a/plugins/modules/activate_job_worker.py b/plugins/modules/activate_job_worker.py index 2240bea..6582dc4 100644 --- a/plugins/modules/activate_job_worker.py +++ b/plugins/modules/activate_job_worker.py @@ -13,11 +13,11 @@ module: itential.platform.activate_job_worker author: Itential -short_description: Activate the job worker for a Platform system +short_description: Activate the job worker for an Itential Platform system description: - The M(itential.platform.activate_job_worker) module activates a - job worker for a Platform system. + job worker for an Itential Platform system. """ diff --git a/plugins/modules/activate_task_worker.py b/plugins/modules/activate_task_worker.py index 855f3b3..6793f25 100644 --- a/plugins/modules/activate_task_worker.py +++ b/plugins/modules/activate_task_worker.py @@ -13,11 +13,11 @@ module: itential.platform.activate_task_worker author: Itential -short_description: Activate the task worker for a Platform system +short_description: Activate the task worker for an Itential Platform system description: - The M(itential.platform.activate_task_worker) module activates a - task worker for a Platform system. + task worker for an Itential Platform system. """ diff --git a/plugins/modules/auth_token.py b/plugins/modules/auth_token.py index 35075de..d02a79a 100644 --- a/plugins/modules/auth_token.py +++ b/plugins/modules/auth_token.py @@ -13,10 +13,11 @@ module: itential.platform.auth_token author: Itential -short_description: Generate an authentication token for Platform. +short_description: Generate an authentication token for Itential Platform. description: - - The M(itential.platform.auth_token) module generates an authentication token for a Platform system. + - The M(itential.platform.auth_token) module generates an authentication token for an + Itential Platform system. - This token can be used to authenticate API requests within the platform. - The module does not require any input parameters. diff --git a/plugins/modules/deactivate_job_worker.py b/plugins/modules/deactivate_job_worker.py index c7d99ff..c7d15bd 100644 --- a/plugins/modules/deactivate_job_worker.py +++ b/plugins/modules/deactivate_job_worker.py @@ -13,11 +13,11 @@ module: itential.platform.deactivate_job_worker author: Itential -short_description: deactivate the job worker for a Platform system +short_description: deactivate the job worker for an Itential Platform system description: - The M(itential.platform.deactivate_job_worker) module deactivates a - job worker for a Platform system. + job worker for an Itential Platform system. """ diff --git a/plugins/modules/deactivate_task_worker.py b/plugins/modules/deactivate_task_worker.py index 63e6873..e0d17e4 100644 --- a/plugins/modules/deactivate_task_worker.py +++ b/plugins/modules/deactivate_task_worker.py @@ -13,11 +13,11 @@ module: itential.platform.deactivate_task_worker author: Itential -short_description: deactivate the task worker for a Platform system +short_description: deactivate the task worker for an Itential Platform system description: - The M(itential.platform.deactivate_task_worker) module deactivates a - task worker for a Platform system. + task worker for an Itential Platform system. """ diff --git a/plugins/modules/generic_request.py b/plugins/modules/generic_request.py index bd47ab0..43ee007 100644 --- a/plugins/modules/generic_request.py +++ b/plugins/modules/generic_request.py @@ -13,12 +13,14 @@ module: itential.platform.api_request author: Itential -short_description: Send a generic API request to a Platform system. +short_description: Send a generic API request to an Itential Platform system. description: - - The M(itential.platform.api_request) module allows users to send generic API requests to a Platform system. + - The M(itential.platform.api_request) module allows users to send generic API requests to an + Itential Platform system. - It supports specifying the HTTP method, endpoint, query parameters, and request body data. - - This module is useful for interacting with various Platform API endpoints without creating dedicated modules. + - This module is useful for interacting with various Itential Platform API endpoints without + creating dedicated modules. options: method: diff --git a/plugins/modules/get_jobs.py b/plugins/modules/get_jobs.py index b7875c4..c0754d7 100644 --- a/plugins/modules/get_jobs.py +++ b/plugins/modules/get_jobs.py @@ -13,10 +13,11 @@ module: itential.platform.get_jobs author: Itential -short_description: Retrieve a list of jobs from a Platform system with optional filtering. +short_description: Retrieve a list of jobs from an Itential Platform system with optional filtering. description: - - The M(itential.platform.get_jobs) module retrieves a list of jobs from a Platform system. + - The M(itential.platform.get_jobs) module retrieves a list of jobs from an + Itential Platform system. - Users can provide key-value pairs as arguments to filter the results based on job attributes. - Filters are dynamically converted to query parameters, allowing for flexible job retrieval. - The response includes the job name and status by default. diff --git a/plugins/modules/get_system_health.py b/plugins/modules/get_system_health.py index 0879fbd..c479772 100644 --- a/plugins/modules/get_system_health.py +++ b/plugins/modules/get_system_health.py @@ -13,11 +13,11 @@ module: itential.platform.get_system_health author: Itential -short_description: Get the health of a Platform system +short_description: Get the health of an Itential Platform system description: - The M(itential.platform.get_system_health) module returns the health of the - Platform system. + Itential Platform system. """ diff --git a/plugins/modules/get_tasks.py b/plugins/modules/get_tasks.py index 55490de..56a3073 100644 --- a/plugins/modules/get_tasks.py +++ b/plugins/modules/get_tasks.py @@ -13,10 +13,12 @@ module: itential.platform.get_tasks author: Itential -short_description: Retrieve a list of tasks from a Platform system with optional filtering. +short_description: Retrieve a list of tasks from an Itential Platform system with +optional filtering. description: - - The M(itential.platform.get_tasks) module retrieves a list of tasks from a Platform system. + - The M(itential.platform.get_tasks) module retrieves a list of tasks from an + Itential Platform system. - Users can provide key-value pairs as arguments to filter the results based on task attributes. - Filters are dynamically converted to query parameters, allowing for flexible task retrieval. - The response includes the task name and status by default. diff --git a/plugins/modules/get_worker_status.py b/plugins/modules/get_worker_status.py index d3b4b68..cfcb15f 100644 --- a/plugins/modules/get_worker_status.py +++ b/plugins/modules/get_worker_status.py @@ -13,11 +13,11 @@ module: itential.platform.get_worker_status author: Itential -short_description: Get the worker status from a Platform system +short_description: Get the worker status from an Itential Platform system description: - The M(itential.platform.get_worker_status) module returns the status of job - and task workers from a Platform system. + and task workers from an Itential Platform system. """ diff --git a/plugins/modules/restart_adapters.py b/plugins/modules/restart_adapters.py index 9a2aabc..7d0f3c9 100644 --- a/plugins/modules/restart_adapters.py +++ b/plugins/modules/restart_adapters.py @@ -13,13 +13,14 @@ module: itential.platform.restart_adapters author: Itential -short_description: Restart one or more adapters in the Platform system. +short_description: Restart one or more adapters in the Itential Platform system. description: - The M(itential.platform.restart_adapters) module restarts one or more adapters in the - Platform system using the names provided via the C(adapter_names) argument. - - This module communicates with the Platform API to perform the restart operation. - - The C(adapter_names) parameter supports both a single adapter name (as a string) and multiple adapter names (as a list). + Itential Platform system using the names provided via the C(adapter_names) argument. + - This module communicates with the Itential Platform API to perform the restart operation. + - The C(adapter_names) parameter supports both a single adapter name (as a string) and + multiple adapter names (as a list). options: adapter_names: diff --git a/plugins/modules/restart_applications.py b/plugins/modules/restart_applications.py index 531cac1..66ff0e3 100644 --- a/plugins/modules/restart_applications.py +++ b/plugins/modules/restart_applications.py @@ -13,13 +13,14 @@ module: itential.platform.restart_applications author: Itential -short_description: Restart one or more applications in the Platform system. +short_description: Restart one or more applications in the Itential Platform system. description: - The M(itential.platform.restart_applications) module restarts one or more applications in the - Platform system using the names provided via the C(application_names) argument. - - This module communicates with the Platform API to perform the restart operation. - - The C(application_names) parameter supports both a single application name (as a string) and multiple application names (as a list). + Itential Platform system using the names provided via the C(application_names) argument. + - This module communicates with the Itential Platform API to perform the restart operation. + - The C(application_names) parameter supports both a single application name (as a string) and + multiple application names (as a list). options: application_names: From b2c7966952190a623cf5bcb086802ed4bacaf1e8 Mon Sep 17 00:00:00 2001 From: WadeStern Date: Wed, 19 Mar 2025 14:47:15 -0400 Subject: [PATCH 6/8] Missed a few "Platforms" --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 4079efc..3f85515 100644 --- a/README.md +++ b/README.md @@ -34,66 +34,66 @@ export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES ### Job Worker Management - **activate_job_worker**: Activate the job worker for an Itential Platform system ```yaml - - name: Activate Platform job worker + - name: Activate Itential Platform job worker itential.platform.activate_job_worker: ``` - **deactivate_job_worker**: Deactivate the job worker for an Itential Platform system ```yaml - - name: Deactivate Platform job worker + - name: Deactivate Itential Platform job worker itential.platform.deactivate_job_worker: ``` ### Task Worker Management - **activate_task_worker**: Activate the task worker for an Itential Platform system ```yaml - - name: Activate Platform task worker + - name: Activate Itential Platform task worker itential.platform.activate_task_worker: ``` - **deactivate_task_worker**: Deactivate the task worker for an Itential Platform system ```yaml - - name: Deactivate Platform task worker + - name: Deactivate Itential Platform task worker itential.platform.deactivate_task_worker: ``` ### System Information - **get_system_health**: Retrieve the health status of an Itential Platform system ```yaml - - name: Get Platform system health + - name: Get Itential Platform system health itential.platform.get_system_health: ``` - **get_worker_status**: Get the current status of Itential Platform workers ```yaml - - name: Get Platform worker status + - name: Get Itential Platform worker status itential.platform.get_worker_status: ``` ### Job and Task Management - **get_jobs**: Retrieve a list of jobs from an Itential Platform system ```yaml - - name: Get Platform jobs + - name: Get Itential Platform jobs itential.platform.get_jobs: ``` - **get_tasks**: Retrieve a list of tasks from an Itential Platform system ```yaml - - name: Get Platform tasks + - name: Get Itential Platform tasks itential.platform.get_tasks: ``` ### System Administration - **restart_adapter**: Restart a specific adapter in the Itential Platform system ```yaml - - name: Restart Platform adapter + - name: Restart Itential Platform adapter itential.platform.restart_adapter: adapter_name: "my-adapter" ``` - **restart_application**: Restart the Itential Platform application ```yaml - - name: Restart Platform application + - name: Restart Itential Platform application itential.platform.restart_application: ``` From 1b8da81ff4c4ef74ba9290bf62deae273989e1e4 Mon Sep 17 00:00:00 2001 From: WadeStern Date: Wed, 19 Mar 2025 14:53:32 -0400 Subject: [PATCH 7/8] Fixed error in documentation. --- plugins/action/restart_applications.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/plugins/action/restart_applications.py b/plugins/action/restart_applications.py index d5d57d7..c2e6ba3 100644 --- a/plugins/action/restart_applications.py +++ b/plugins/action/restart_applications.py @@ -9,19 +9,22 @@ # # Examples: # - name: Restart a single application (string input) -# itential.platform.restart_application: -# application_names: "platform-core" -# +# itential.platform.restart_applications: +# application_names: OperationsManager +# delegate_to: localhost + # - name: Restart a single application (list input) -# itential.platform.restart_application: +# itential.platform.restart_applications: # application_names: -# - platform-core -# +# - OperationsManager +# delegate_to: localhost + # - name: Restart multiple applications -# itential.platform.restart_application: +# itential.platform.restart_applications: # application_names: -# - platform-core +# - OperationsManager # - ag-manager +# delegate_to: localhost from ansible.plugins.action import ActionBase from ansible_collections.itential.platform.plugins.module_utils.request import make_request From 42f8db456e5399d6739832253b98ca594c3361cc Mon Sep 17 00:00:00 2001 From: WadeStern Date: Wed, 19 Mar 2025 15:09:35 -0400 Subject: [PATCH 8/8] Previous commit broke coverage report. --- plugins/action/restart_applications.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/plugins/action/restart_applications.py b/plugins/action/restart_applications.py index c2e6ba3..33f82c8 100644 --- a/plugins/action/restart_applications.py +++ b/plugins/action/restart_applications.py @@ -11,20 +11,17 @@ # - name: Restart a single application (string input) # itential.platform.restart_applications: # application_names: OperationsManager -# delegate_to: localhost - +# # - name: Restart a single application (list input) # itential.platform.restart_applications: # application_names: # - OperationsManager -# delegate_to: localhost - +# # - name: Restart multiple applications # itential.platform.restart_applications: # application_names: # - OperationsManager # - ag-manager -# delegate_to: localhost from ansible.plugins.action import ActionBase from ansible_collections.itential.platform.plugins.module_utils.request import make_request