From c58fa34564097aee0bf9cdbdf2b6f914f71da669 Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Thu, 12 Sep 2024 11:28:45 +0200 Subject: [PATCH] Ensure the mandatory fields required by the EDA API are respcted within the modules Signed-off-by: Alina Buzachis --- plugins/modules/activation.py | 8 ++++---- plugins/modules/activation_info.py | 6 +++--- plugins/modules/controller_token.py | 6 +++--- plugins/modules/credential.py | 6 +++--- plugins/modules/credential_info.py | 6 +++--- plugins/modules/credential_type.py | 6 +++--- plugins/modules/credential_type_info.py | 6 +++--- plugins/modules/decision_environment.py | 6 +++--- plugins/modules/decision_environment_info.py | 6 +++--- plugins/modules/event_stream.py | 2 +- plugins/modules/project.py | 4 ++-- plugins/modules/project_info.py | 6 +++--- plugins/modules/user.py | 6 +++--- tests/integration/targets/event_stream/tasks/main.yml | 3 +++ 14 files changed, 40 insertions(+), 37 deletions(-) diff --git a/plugins/modules/activation.py b/plugins/modules/activation.py index 472729e9..4d43cf09 100644 --- a/plugins/modules/activation.py +++ b/plugins/modules/activation.py @@ -9,7 +9,7 @@ __metaclass__ = type -DOCUMENTATION = """ +DOCUMENTATION = r""" --- module: activation author: @@ -133,7 +133,7 @@ not perform any modification when an existing rulebook activation is found. """ -EXAMPLES = """ +EXAMPLES = r""" - name: Create a rulebook activation ansible.eda.activation: name: "Example Rulebook Activation" @@ -151,7 +151,7 @@ """ -RETURN = """ +RETURN = r""" id: description: ID of the rulebook activation. returned: when exists @@ -315,7 +315,7 @@ def main() -> None: ( "state", "present", - ("name", "rulebook_name", "decision_environment_name"), + ("name", "rulebook_name", "decision_environment_name", "project_name"), ) ] diff --git a/plugins/modules/activation_info.py b/plugins/modules/activation_info.py index d440dd0d..b5a3ce1c 100644 --- a/plugins/modules/activation_info.py +++ b/plugins/modules/activation_info.py @@ -9,7 +9,7 @@ __metaclass__ = type -DOCUMENTATION = """ +DOCUMENTATION = r""" --- module: activation_info author: @@ -29,7 +29,7 @@ """ -EXAMPLES = """ +EXAMPLES = r""" - name: Get information about a rulebook activation ansible.eda.activation_info: name: "Example Rulebook Activation" @@ -39,7 +39,7 @@ """ -RETURN = """ +RETURN = r""" activations: description: Information about rulebook activations. returned: always diff --git a/plugins/modules/controller_token.py b/plugins/modules/controller_token.py index 61cd5bd1..4bb793b3 100644 --- a/plugins/modules/controller_token.py +++ b/plugins/modules/controller_token.py @@ -8,7 +8,7 @@ __metaclass__ = type -DOCUMENTATION = """ +DOCUMENTATION = r""" --- module: controller_token author: @@ -47,7 +47,7 @@ - ansible.eda.eda_controller.auths """ -EXAMPLES = """ +EXAMPLES = r""" - name: Create AWX token ansible.eda.controller_token: controller_host: https://my_eda_host/ @@ -69,7 +69,7 @@ """ -RETURN = """ +RETURN = r""" id: description: ID of the managed AWX token. returned: when state is 'present' and successful diff --git a/plugins/modules/credential.py b/plugins/modules/credential.py index 23c27b44..f69b643d 100644 --- a/plugins/modules/credential.py +++ b/plugins/modules/credential.py @@ -10,7 +10,7 @@ __metaclass__ = type -DOCUMENTATION = """ +DOCUMENTATION = r""" --- module: credential author: @@ -61,7 +61,7 @@ """ -EXAMPLES = """ +EXAMPLES = r""" - name: Create an EDA Credential ansible.eda.credential: name: "Example Credential" @@ -78,7 +78,7 @@ """ -RETURN = """ +RETURN = r""" id: description: ID of the credential. returned: when exists diff --git a/plugins/modules/credential_info.py b/plugins/modules/credential_info.py index 3e1bebc7..64f1e688 100644 --- a/plugins/modules/credential_info.py +++ b/plugins/modules/credential_info.py @@ -9,7 +9,7 @@ __metaclass__ = type -DOCUMENTATION = """ +DOCUMENTATION = r""" --- module: credential_info author: @@ -31,7 +31,7 @@ """ -EXAMPLES = """ +EXAMPLES = r""" - name: Get information about a credential ansible.eda.credential_info: name: "Test" @@ -41,7 +41,7 @@ """ -RETURN = """ +RETURN = r""" credentials: description: Information about credentials. returned: always diff --git a/plugins/modules/credential_type.py b/plugins/modules/credential_type.py index ed085667..9b672391 100644 --- a/plugins/modules/credential_type.py +++ b/plugins/modules/credential_type.py @@ -9,7 +9,7 @@ __metaclass__ = type -DOCUMENTATION = """ +DOCUMENTATION = r""" --- module: credential_type author: @@ -53,7 +53,7 @@ """ -EXAMPLES = """ +EXAMPLES = r""" - name: Create a credential type ansible.eda.credential_type: name: "Test" @@ -75,7 +75,7 @@ """ -RETURN = """ +RETURN = r""" id: description: ID of the credential type. returned: when exists diff --git a/plugins/modules/credential_type_info.py b/plugins/modules/credential_type_info.py index e0f3e3dd..ecdb89f8 100644 --- a/plugins/modules/credential_type_info.py +++ b/plugins/modules/credential_type_info.py @@ -9,7 +9,7 @@ __metaclass__ = type -DOCUMENTATION = """ +DOCUMENTATION = r""" --- module: credential_type_info author: @@ -31,7 +31,7 @@ """ -EXAMPLES = """ +EXAMPLES = r""" - name: Get information about a credential type ansible.eda.credential_type_info: name: "Test" @@ -41,7 +41,7 @@ """ -RETURN = """ +RETURN = r""" credential_types: description: Information about the credential types. returned: always diff --git a/plugins/modules/decision_environment.py b/plugins/modules/decision_environment.py index e330c3bf..9279d7a6 100644 --- a/plugins/modules/decision_environment.py +++ b/plugins/modules/decision_environment.py @@ -8,7 +8,7 @@ __metaclass__ = type -DOCUMENTATION = """ +DOCUMENTATION = r""" --- module: decision_environment author: @@ -57,7 +57,7 @@ - ansible.eda.eda_controller.auths """ -EXAMPLES = """ +EXAMPLES = r""" - name: Create EDA Decision Environment ansible.eda.decision_environment: controller_host: https://my_eda_host/ @@ -89,7 +89,7 @@ state: absent """ -RETURN = """ +RETURN = r""" id: description: ID of the decision environment returned: when exists diff --git a/plugins/modules/decision_environment_info.py b/plugins/modules/decision_environment_info.py index 5b26bb7c..419d242a 100644 --- a/plugins/modules/decision_environment_info.py +++ b/plugins/modules/decision_environment_info.py @@ -8,7 +8,7 @@ __metaclass__ = type -DOCUMENTATION = """ +DOCUMENTATION = r""" --- module: decision_environment_info author: @@ -26,7 +26,7 @@ - ansible.eda.eda_controller.auths """ -EXAMPLES = """ +EXAMPLES = r""" - name: List all EDA Decision Environments ansible.eda.decision_environment_info: controller_host: https://my_eda_host/ @@ -41,7 +41,7 @@ name: Example """ -RETURN = """ +RETURN = r""" decision_environments: description: List of dict containing information about decision environments returned: when exists diff --git a/plugins/modules/event_stream.py b/plugins/modules/event_stream.py index 1e40e4b8..fa4a3b2e 100644 --- a/plugins/modules/event_stream.py +++ b/plugins/modules/event_stream.py @@ -145,7 +145,7 @@ def main() -> None: ( "state", "present", - ("name", "credential_name"), + ("name", "credential_name", "event_stream_type"), ) ] diff --git a/plugins/modules/project.py b/plugins/modules/project.py index 4e6ca8a9..71fe64f3 100644 --- a/plugins/modules/project.py +++ b/plugins/modules/project.py @@ -8,7 +8,7 @@ __metaclass__ = type -DOCUMENTATION = """ +DOCUMENTATION = r""" --- module: project author: @@ -57,7 +57,7 @@ - ansible.eda.eda_controller.auths """ -EXAMPLES = """ +EXAMPLES = r""" - name: Create EDA Projects ansible.eda.project: controller_host: https://my_eda_host/ diff --git a/plugins/modules/project_info.py b/plugins/modules/project_info.py index 5455351d..e5ff86f9 100644 --- a/plugins/modules/project_info.py +++ b/plugins/modules/project_info.py @@ -8,7 +8,7 @@ __metaclass__ = type -DOCUMENTATION = """ +DOCUMENTATION = r""" --- module: project_info author: @@ -27,7 +27,7 @@ - ansible.eda.eda_controller.auths """ -EXAMPLES = """ +EXAMPLES = r""" - name: List a particular project ansible.eda.project_info: controller_host: https://my_eda_host/ @@ -44,7 +44,7 @@ register: r """ -RETURN = """ +RETURN = r""" projects: description: List of dicts containing information about projects returned: success diff --git a/plugins/modules/user.py b/plugins/modules/user.py index c1d02878..48f51e27 100644 --- a/plugins/modules/user.py +++ b/plugins/modules/user.py @@ -8,7 +8,7 @@ __metaclass__ = type -DOCUMENTATION = """ +DOCUMENTATION = r""" --- module: user author: @@ -77,7 +77,7 @@ - ansible.eda.eda_controller.auths """ -EXAMPLES = """ +EXAMPLES = r""" - name: Create EDA user ansible.eda.user: controller_host: https://my_eda_host/ @@ -111,7 +111,7 @@ """ -RETURN = """ +RETURN = r""" id: description: ID of the managed AWX token. returned: when state is 'present' and successful diff --git a/tests/integration/targets/event_stream/tasks/main.yml b/tests/integration/targets/event_stream/tasks/main.yml index 15db0ec9..516ce543 100644 --- a/tests/integration/targets/event_stream/tasks/main.yml +++ b/tests/integration/targets/event_stream/tasks/main.yml @@ -46,6 +46,7 @@ name: "{{ event_stream_name }}" credential_name: "{{ credential_name }}" organization_name: Default + event_stream_type: "Basic Event Stream" check_mode: true register: _result @@ -60,6 +61,7 @@ name: "{{ event_stream_name }}" credential_name: "{{ credential_name }}" organization_name: Default + event_stream_type: "Basic Event Stream" register: _result - name: Check event stream is not created again @@ -73,6 +75,7 @@ name: "{{ event_stream_name }}" credential_name: "{{ credential_name }}" organization_name: Default + event_stream_type: "Basic Event Stream" register: _result # [WARNING]: The field eda_credential_id of unknown 2 has encrypted data and may