From 5d361aa16487af336ca63b93bdf297c7ed664e85 Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Mon, 19 Aug 2024 18:21:01 +0200 Subject: [PATCH 1/8] Run integration tests in CI Signed-off-by: Alina Buzachis --- .github/workflows/integration.yml | 71 +++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .github/workflows/integration.yml diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml new file mode 100644 index 00000000..f820d408 --- /dev/null +++ b/.github/workflows/integration.yml @@ -0,0 +1,71 @@ +name: Run integration tests +on: + pull_request: + types: + - opened + - reopened + - labeled + - unlabeled + - synchronize + branches: + - main + - stable-* + schedule: + - cron: '0 */8 * * *' + +jobs: + integration-tests: + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: + - "3.11" + ansible-version: + - "milestone" + + env: + CONTROLLER_URL: "https://localhost:8443" + CONTROLLER_USERNAME: "admin" + CONTROLLER_PASSWORD: "testpass" + CONTROLLER_VERIFY_SSL: false + + steps: + - name: Checkout ansible/eda + uses: actions/checkout@v3 + with: + path: ansible_collections/ansible/eda + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: "0" + + - name: Checkout ansible/eda-server + uses: actions/checkout@v3 + with: + repository: ansible/eda-server + path: eda-server # Note: Specify a separate path for this repository + + - name: Run API in background + run: | + docker compose -p eda -f docker-compose-stage.yaml pull + docker compose -p eda -f docker-compose-stage.yaml up -d + until curl -s http://localhost:8000/_healthz | grep -q "OK"; do + echo "Waiting for API to be ready..." + sleep 1 + done + working-directory: eda-server/tools/docker # Adjusted to the specific directory where docker-compose.yaml is located + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install ansible-core (${{ matrix.ansible-version }}) + run: >- + python3 -m pip install + https://github.com/ansible/ansible/archive/${{ matrix.ansible-version }}.tar.gz + --disable-pip-version-check + shell: bash + + - name: Run integration tests + run: ansible-test integration -v + working-directory: ansible_collections/ansible/eda From dde5f06f9a099e97cbce4a67f30c86244977317f Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Mon, 19 Aug 2024 12:08:12 -0700 Subject: [PATCH 2/8] activation tests fix Signed-off-by: Abhijeet Kasurde # Conflicts: # .config/dictionary.txt --- .config/dictionary.txt | 1 + .github/workflows/integration.yml | 20 ++++++++++++------- .../integration_config.yaml.template | 4 ++++ .../targets/activation/tasks/main.yml | 6 ++++-- 4 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 tests/integration/integration_config.yaml.template diff --git a/.config/dictionary.txt b/.config/dictionary.txt index 826c7b92..ed3de8ca 100644 --- a/.config/dictionary.txt +++ b/.config/dictionary.txt @@ -68,3 +68,4 @@ testuser toxinidir trustore truststore +testpass diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index f820d408..d79fc0be 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -24,12 +24,6 @@ jobs: ansible-version: - "milestone" - env: - CONTROLLER_URL: "https://localhost:8443" - CONTROLLER_USERNAME: "admin" - CONTROLLER_PASSWORD: "testpass" - CONTROLLER_VERIFY_SSL: false - steps: - name: Checkout ansible/eda uses: actions/checkout@v3 @@ -66,6 +60,18 @@ jobs: --disable-pip-version-check shell: bash + - name: Print the ansible version + run: ansible --version + + - name: Create integration_config.yml + run: | + touch tests/integration/integration_config.yml + echo "controller_host: 'https://localhost:8443'" >> tests/integration/integration_config.yml + echo "controller_username: 'admin'" >> tests/integration/integration_config.yml + echo "controller_password: 'testpass'" >> tests/integration/integration_config.yml + echo "controller_verify_ssl: false" >> tests/integration/integration_config.yml + working-directory: ansible_collections/ansible/eda + - name: Run integration tests - run: ansible-test integration -v + run: ansible-test integration project working-directory: ansible_collections/ansible/eda diff --git a/tests/integration/integration_config.yaml.template b/tests/integration/integration_config.yaml.template new file mode 100644 index 00000000..89544916 --- /dev/null +++ b/tests/integration/integration_config.yaml.template @@ -0,0 +1,4 @@ +controller_host: "https://localhost:8443" +controller_username: "admin" +controller_password: "testpass" +controller_verify_ssl: false diff --git a/tests/integration/targets/activation/tasks/main.yml b/tests/integration/targets/activation/tasks/main.yml index 76ac9d7f..65c2b356 100644 --- a/tests/integration/targets/activation/tasks/main.yml +++ b/tests/integration/targets/activation/tasks/main.yml @@ -1,11 +1,13 @@ --- - block: - - set_fact: + - name: Set defaults for credentials + set_fact: credential_defaults: &credential_defaults controller_username: "{{ controller_username }}" controller_password: "{{ controller_password }}" controller_host: "{{ controller_host }}" - validate_certs: false + validate_certs: "{{ controller_verify_ssl }}" + no_log: true - name: Generate a random_string for the test set_fact: From 1927941a842bbe5d9bdf7d716fbb2b5266d1156a Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Tue, 20 Aug 2024 11:57:08 +0200 Subject: [PATCH 3/8] Fix integration tests and add suppport for organization_name for some modules Signed-off-by: Alina Buzachis --- plugins/modules/credential.py | 17 +++++++---- plugins/modules/decision_environment.py | 24 +++++++++++++++- plugins/modules/project.py | 28 ++++++++++++++++++- .../targets/activation/tasks/main.yml | 6 ++++ .../targets/credential/tasks/main.yml | 5 ++++ .../decision_environment/tasks/create.yml | 3 ++ .../decision_environment/tasks/update.yml | 3 ++ .../decision_environment_info/tasks/list.yml | 1 + .../targets/project/tasks/create.yml | 3 ++ .../targets/project/tasks/update.yml | 3 ++ .../targets/project_info/tasks/create.yml | 1 + 11 files changed, 87 insertions(+), 7 deletions(-) diff --git a/plugins/modules/credential.py b/plugins/modules/credential.py index 4f506791..fc1ddc58 100644 --- a/plugins/modules/credential.py +++ b/plugins/modules/credential.py @@ -41,9 +41,9 @@ organization_name: description: - The name of the organization. - type: int + type: str aliases: - - org_name + - organization description: description: - Description of the credential. @@ -67,6 +67,7 @@ inputs: field1: "field1" credential_type_name: "GitLab Personal Access Token" + organization_name: Default - name: Delete an EDA Credential ansible.eda.credential: @@ -108,13 +109,19 @@ def main() -> None: description=dict(type="str"), inputs=dict(type="dict"), credential_type_name=dict(type="str"), - organization_name=dict(type="int", aliases=["org_name"]), + organization_name=dict(type="str", aliases=["organization"]), state=dict(choices=["present", "absent"], default="present"), ) argument_spec.update(AUTH_ARGSPEC) - required_if = [("state", "present", ("name", "credential_type_name", "inputs"))] + required_if = [ + ( + "state", + "present", + ("name", "credential_type_name", "inputs", "organization_name"), + ) + ] module = AnsibleModule( argument_spec=argument_spec, required_if=required_if, supports_check_mode=True @@ -154,7 +161,7 @@ def main() -> None: credential_params["credential_type_id"] = credential_type_id organization_id = None - if module.params.get("organization_id"): + if module.params.get("organization_name"): organization_id = lookup( module, controller, "organizations", module.params["organization_name"] ) diff --git a/plugins/modules/decision_environment.py b/plugins/modules/decision_environment.py index 4380db2a..6166f399 100644 --- a/plugins/modules/decision_environment.py +++ b/plugins/modules/decision_environment.py @@ -46,6 +46,12 @@ default: "present" choices: ["present", "absent"] type: str + organization_name: + description: + - The name of the organization. + type: str + aliases: + - organization extends_documentation_fragment: - ansible.eda.eda_controller.auths """ @@ -60,6 +66,7 @@ description: "Example Decision Environment description" image_url: "quay.io/test" credential: "Example Credential" + organization_name: Default state: present - name: Update the name of the Decision Environment @@ -69,6 +76,7 @@ controller_password: MySuperSecretPassw0rd name: "Example Decision Environment" new_name: "Latest Example Decision Environment" + organization_name: Default state: present - name: Delete the the Decision Environment @@ -103,12 +111,17 @@ def main() -> None: description=dict(), image_url=dict(), credential=dict(), + organization_name=dict(type="str", aliases=["organization"]), state=dict(choices=["present", "absent"], default="present"), ) argument_spec.update(AUTH_ARGSPEC) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + required_if = [("state", "present", ("name", "organization_name", "image_url"))] + + module = AnsibleModule( + argument_spec=argument_spec, required_if=required_if, supports_check_mode=True + ) client = Client( host=module.params.get("controller_host"), @@ -166,6 +179,15 @@ def main() -> None: # in the loop above decision_environment_type_params["credential"] = credential_type["id"] + organization_id = None + if module.params.get("organization_name"): + organization_id = controller.resolve_name_to_id( + "organizations", module.params["organization_name"] + ) + + if organization_id: + decision_environment_type_params["organization_id"] = organization_id + if new_name: decision_environment_type_params["name"] = new_name elif decision_environment_type: diff --git a/plugins/modules/project.py b/plugins/modules/project.py index ee41f9f1..c619ea74 100644 --- a/plugins/modules/project.py +++ b/plugins/modules/project.py @@ -40,6 +40,12 @@ description: - The name of the credential to associate with the project. type: str + organization_name: + description: + - The name of the organization. + type: str + aliases: + - organization state: description: - Desired state of the resource. @@ -59,6 +65,7 @@ name: "Example Project" description: "Example project description" url: "https://example.com/project1" + organizatiion_name: Default state: present - name: Update the name of the project @@ -70,6 +77,7 @@ new_name: "Latest Example Project" description: "Example project description" url: "https://example.com/project1" + organization_name: Default state: present - name: Delete the project @@ -98,12 +106,17 @@ def main() -> None: description=dict(), url=dict(), credential=dict(), + organization_name=dict(type="str", aliases=["organization"]), state=dict(choices=["present", "absent"], default="present"), ) argument_spec.update(AUTH_ARGSPEC) - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + required_if = [("state", "present", ("name", "url", "organization_name"))] + + module = AnsibleModule( + argument_spec=argument_spec, required_if=required_if, supports_check_mode=True + ) client = Client( host=module.params.get("controller_host"), @@ -158,6 +171,19 @@ def main() -> None: # in the loop above project_type_params["eda_credential_id"] = credential_id["id"] + organization_id = None + if module.params.get("organization_name"): + try: + organization_id = controller.resolve_name_to_id( + "organizations", module.params["organization_name"] + ) + except EDAError as eda_err: + module.fail_json(msg=str(eda_err)) + raise + + if organization_id: + project_type_params["organization_id"] = organization_id + if new_name: project_type_params["name"] = new_name elif project_type: diff --git a/tests/integration/targets/activation/tasks/main.yml b/tests/integration/targets/activation/tasks/main.yml index 65c2b356..ecd277fb 100644 --- a/tests/integration/targets/activation/tasks/main.yml +++ b/tests/integration/targets/activation/tasks/main.yml @@ -99,6 +99,7 @@ password: secret ssh_key_data: "{{ ssh_key_data }}" ssh_key_unlock: "passphrase" + organization_name: Default register: credential_creation - name: Assert that the credential was created successfully @@ -114,6 +115,7 @@ description: "Test Project Description" url: "{{ scm_url }}" credential: "{{ credential_name }}" + organization_name: Default state: present register: project_creation @@ -130,6 +132,7 @@ description: "Test Decision Environment Description" credential: "{{ credential_name }}" image_url: "{{ image_url }}" + organization_name: Default register: decision_environment_creation - name: Create a new rulebook activation in check mode @@ -142,6 +145,7 @@ decision_environment_name: "{{ decision_env_name }}" enabled: False awx_token_name: "{{ awx_token_name }}" + organization_name: Default check_mode: true register: _result @@ -160,6 +164,7 @@ decision_environment_name: "{{ decision_env_name }}" enabled: False awx_token_name: "{{ awx_token_name }}" + organization_name: Default register: _result - name: Check rulebook activation creation @@ -177,6 +182,7 @@ decision_environment_name: "{{ decision_env_name }}" enabled: False awx_token_name: "{{ awx_token_name }}" + organization_name: Default register: _result - name: Check rulebook activation creation diff --git a/tests/integration/targets/credential/tasks/main.yml b/tests/integration/targets/credential/tasks/main.yml index 7952cfa1..fa995e57 100644 --- a/tests/integration/targets/credential/tasks/main.yml +++ b/tests/integration/targets/credential/tasks/main.yml @@ -48,6 +48,7 @@ credential_type_name: "{{ credential_type_name }}" inputs: field1: "field1" + organization_name: Default check_mode: true register: _result @@ -65,6 +66,7 @@ credential_type_name: "{{ credential_type_name }}" inputs: field1: "field1" + organization_name: Default register: _result - name: Check credential creation @@ -81,6 +83,7 @@ credential_type_name: "{{ credential_type_name }}" inputs: field1: "field1" + organization_name: Default register: _result # [WARNING]: The field inputs of unknown 3 has encrypted data and may inaccurately report task is changed. @@ -105,6 +108,7 @@ credential_type_name: "{{ credential_type_name }}" inputs: field1: "field1" + organization_name: Default register: _result - name: Check credential update @@ -121,6 +125,7 @@ credential_type_name: "{{ credential_type_name }}" inputs: field1: "field1" + organization_name: Default register: _result # [WARNING]: The field inputs of unknown 3 has encrypted data and may inaccurately report task is changed. diff --git a/tests/integration/targets/decision_environment/tasks/create.yml b/tests/integration/targets/decision_environment/tasks/create.yml index 30124a5a..1547ecbb 100644 --- a/tests/integration/targets/decision_environment/tasks/create.yml +++ b/tests/integration/targets/decision_environment/tasks/create.yml @@ -10,6 +10,7 @@ name: "{{ decision_env_name }}" description: "Example decision environment description" image_url: "{{ image_url }}" + organization_name: Default state: present check_mode: true register: r @@ -27,6 +28,7 @@ name: "{{ decision_env_name }}" description: "Example decision environment description" image_url: "{{ image_url }}" + organization_name: Default state: present register: r @@ -43,6 +45,7 @@ name: "{{ decision_env_name }}" description: "Example decision environment description" image_url: "{{ image_url }}" + organization_name: Default state: present register: r diff --git a/tests/integration/targets/decision_environment/tasks/update.yml b/tests/integration/targets/decision_environment/tasks/update.yml index 046801c1..2d44be28 100644 --- a/tests/integration/targets/decision_environment/tasks/update.yml +++ b/tests/integration/targets/decision_environment/tasks/update.yml @@ -10,6 +10,7 @@ name: "{{ decision_env_name }}" description: "Example decision environment description" image_url: "{{ image_url }}" + organization_name: Default state: present register: r @@ -27,6 +28,7 @@ new_name: "{{ decision_env_name }}_new" description: "Example decision environment description" image_url: "{{ image_url }}" + organization_name: Default state: present register: r @@ -44,6 +46,7 @@ new_name: "{{ decision_env_name }}_new" description: "Example decision environment description" image_url: "{{ image_url }}" + organization_name: Default state: present register: r diff --git a/tests/integration/targets/decision_environment_info/tasks/list.yml b/tests/integration/targets/decision_environment_info/tasks/list.yml index 299ae39a..f248898c 100644 --- a/tests/integration/targets/decision_environment_info/tasks/list.yml +++ b/tests/integration/targets/decision_environment_info/tasks/list.yml @@ -10,6 +10,7 @@ name: "{{ decision_env_name }}" description: "Example decision environment description" image_url: "{{ image_url }}" + organization_name: Default state: present register: r diff --git a/tests/integration/targets/project/tasks/create.yml b/tests/integration/targets/project/tasks/create.yml index 32d74ba5..4f7e0bae 100644 --- a/tests/integration/targets/project/tasks/create.yml +++ b/tests/integration/targets/project/tasks/create.yml @@ -10,6 +10,7 @@ name: "{{ project_name }}" url: "{{ url }}" description: "Example project description" + organization_name: Default state: present check_mode: true register: r @@ -27,6 +28,7 @@ name: "{{ project_name }}" url: "{{ url }}" description: "Example project description" + organization_name: Default state: present register: r @@ -43,6 +45,7 @@ name: "{{ project_name }}" url: "{{ url }}" description: "Example project description" + organization_name: Default state: present register: r diff --git a/tests/integration/targets/project/tasks/update.yml b/tests/integration/targets/project/tasks/update.yml index b6d8117c..eace6723 100644 --- a/tests/integration/targets/project/tasks/update.yml +++ b/tests/integration/targets/project/tasks/update.yml @@ -10,6 +10,7 @@ name: "{{ project_name }}" url: "{{ url }}" description: "Example project description" + organization_name: Default state: present register: r @@ -27,6 +28,7 @@ url: "{{ url }}" new_name: "{{ project_name }}_new" description: "Example project description" + organization_name: Default state: present register: r @@ -44,6 +46,7 @@ new_name: "{{ project_name }}_new" description: "Example project description" url: "https://example.com/project1" + organization_name: Default state: present register: r diff --git a/tests/integration/targets/project_info/tasks/create.yml b/tests/integration/targets/project_info/tasks/create.yml index eb92b83e..f361411c 100644 --- a/tests/integration/targets/project_info/tasks/create.yml +++ b/tests/integration/targets/project_info/tasks/create.yml @@ -10,6 +10,7 @@ name: Example description: "Example project description" url: "https://example.com/project1" + organization_name: Default state: present register: r From 8431c9a9c40af6d078a08498fc324785fe508099 Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Tue, 20 Aug 2024 12:22:02 +0200 Subject: [PATCH 4/8] Fixes Signed-off-by: Alina Buzachis --- meta/runtime.yml | 6 +++ plugins/modules/project.py | 2 +- .../targets/activation/tasks/main.yml | 2 +- .../targets/controller_token/tasks/create.yml | 15 ++++--- .../targets/controller_token/tasks/main.yml | 5 ++- .../targets/credential/tasks/main.yml | 1 + .../targets/credential_type/tasks/main.yml | 1 + .../decision_environment/tasks/create.yml | 25 +++++++----- .../decision_environment/tasks/delete.yml | 13 ++++-- .../decision_environment/tasks/main.yml | 5 ++- .../decision_environment/tasks/update.yml | 20 ++++++---- .../decision_environment_info/tasks/list.yml | 25 +++++++----- .../decision_environment_info/tasks/main.yml | 5 ++- .../targets/project/tasks/create.yml | 25 +++++++----- .../targets/project/tasks/delete.yml | 12 ++++-- .../targets/project/tasks/main.yml | 5 ++- .../targets/project/tasks/update.yml | 20 ++++++---- .../targets/project_info/tasks/create.yml | 5 ++- .../targets/project_info/tasks/main.yml | 25 +++++++----- .../integration/targets/user/tasks/create.yml | 40 +++++++++++-------- tests/integration/targets/user/tasks/main.yml | 5 ++- .../integration/targets/user/tasks/update.yml | 15 ++++--- 22 files changed, 171 insertions(+), 106 deletions(-) diff --git a/meta/runtime.yml b/meta/runtime.yml index c7793370..62b63ad3 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -6,7 +6,13 @@ action_groups: eda: - activation - activation_info + - controller_token - credential - credential_info - credential_type - credential_type_info + - decision_environment + - decision_environment_info + - project + - project_info + - user diff --git a/plugins/modules/project.py b/plugins/modules/project.py index c619ea74..9b1a7a77 100644 --- a/plugins/modules/project.py +++ b/plugins/modules/project.py @@ -65,7 +65,7 @@ name: "Example Project" description: "Example project description" url: "https://example.com/project1" - organizatiion_name: Default + organization_name: Default state: present - name: Update the name of the project diff --git a/tests/integration/targets/activation/tasks/main.yml b/tests/integration/targets/activation/tasks/main.yml index ecd277fb..adf74914 100644 --- a/tests/integration/targets/activation/tasks/main.yml +++ b/tests/integration/targets/activation/tasks/main.yml @@ -6,7 +6,7 @@ controller_username: "{{ controller_username }}" controller_password: "{{ controller_password }}" controller_host: "{{ controller_host }}" - validate_certs: "{{ controller_verify_ssl }}" + validate_certs: false no_log: true - name: Generate a random_string for the test diff --git a/tests/integration/targets/controller_token/tasks/create.yml b/tests/integration/targets/controller_token/tasks/create.yml index ac607806..0e22d5d7 100644 --- a/tests/integration/targets/controller_token/tasks/create.yml +++ b/tests/integration/targets/controller_token/tasks/create.yml @@ -5,8 +5,9 @@ - name: Create controller token in check mode ansible.eda.controller_token: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ controller_token_name }}" description: "Example controller token description" token: "TOKEN_VALUE" @@ -23,8 +24,9 @@ - name: Create controller token ansible.eda.controller_token: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ controller_token_name }}" description: "Example controller token description" token: "TOKEN_VALUE" @@ -41,8 +43,9 @@ - name: Create controller token again ansible.eda.controller_token: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ controller_token_name }}" description: "Example controller token description" token: "TOKEN_VALUE" diff --git a/tests/integration/targets/controller_token/tasks/main.yml b/tests/integration/targets/controller_token/tasks/main.yml index 512dd5dc..3b0a3c76 100644 --- a/tests/integration/targets/controller_token/tasks/main.yml +++ b/tests/integration/targets/controller_token/tasks/main.yml @@ -22,8 +22,9 @@ - name: Clean up - controller token ansible.eda.controller_token: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ item }}" state: absent loop: diff --git a/tests/integration/targets/credential/tasks/main.yml b/tests/integration/targets/credential/tasks/main.yml index fa995e57..9af282a1 100644 --- a/tests/integration/targets/credential/tasks/main.yml +++ b/tests/integration/targets/credential/tasks/main.yml @@ -6,6 +6,7 @@ controller_password: "{{ controller_password }}" controller_host: "{{ controller_host }}" validate_certs: false + no_log: true - name: Generate a random_string for the test set_fact: diff --git a/tests/integration/targets/credential_type/tasks/main.yml b/tests/integration/targets/credential_type/tasks/main.yml index 2f250936..503ed34f 100644 --- a/tests/integration/targets/credential_type/tasks/main.yml +++ b/tests/integration/targets/credential_type/tasks/main.yml @@ -6,6 +6,7 @@ controller_password: "{{ controller_password }}" controller_host: "{{ controller_host }}" validate_certs: false + no_log: true - name: Generate a random_string for the test set_fact: diff --git a/tests/integration/targets/decision_environment/tasks/create.yml b/tests/integration/targets/decision_environment/tasks/create.yml index 1547ecbb..83fb976b 100644 --- a/tests/integration/targets/decision_environment/tasks/create.yml +++ b/tests/integration/targets/decision_environment/tasks/create.yml @@ -5,8 +5,9 @@ - name: Create decision environment in check mode ansible.eda.decision_environment: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ decision_env_name }}" description: "Example decision environment description" image_url: "{{ image_url }}" @@ -23,8 +24,9 @@ - name: Create decision environment ansible.eda.decision_environment: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ decision_env_name }}" description: "Example decision environment description" image_url: "{{ image_url }}" @@ -40,8 +42,9 @@ - name: Create decision environment again ansible.eda.decision_environment: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ decision_env_name }}" description: "Example decision environment description" image_url: "{{ image_url }}" @@ -57,8 +60,9 @@ - name: Delete decision environment in check mode ansible.eda.decision_environment: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ decision_env_name }}" state: absent check_mode: true @@ -72,8 +76,9 @@ - name: Delete decision environment ansible.eda.decision_environment: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ decision_env_name }}" state: absent register: r diff --git a/tests/integration/targets/decision_environment/tasks/delete.yml b/tests/integration/targets/decision_environment/tasks/delete.yml index 9e24c206..399c1657 100644 --- a/tests/integration/targets/decision_environment/tasks/delete.yml +++ b/tests/integration/targets/decision_environment/tasks/delete.yml @@ -5,6 +5,9 @@ - name: Delete operation without required name parameter ansible.eda.decision_environment: controller_host: "{{ controller_host }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" state: absent ignore_errors: true register: r @@ -18,8 +21,9 @@ - name: Delete non-existing decision environment in check mode ansible.eda.decision_environment: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: Example state: absent check_mode: true @@ -33,8 +37,9 @@ - name: Delete non-existing decision environment ansible.eda.decision_environment: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: Example state: absent register: r diff --git a/tests/integration/targets/decision_environment/tasks/main.yml b/tests/integration/targets/decision_environment/tasks/main.yml index 0d6b0331..4c0687c1 100644 --- a/tests/integration/targets/decision_environment/tasks/main.yml +++ b/tests/integration/targets/decision_environment/tasks/main.yml @@ -25,8 +25,9 @@ - name: Clean up - decision environment ansible.eda.decision_environment: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ item }}" state: absent loop: diff --git a/tests/integration/targets/decision_environment/tasks/update.yml b/tests/integration/targets/decision_environment/tasks/update.yml index 2d44be28..f7a01d7b 100644 --- a/tests/integration/targets/decision_environment/tasks/update.yml +++ b/tests/integration/targets/decision_environment/tasks/update.yml @@ -5,8 +5,9 @@ - name: Create decision environment ansible.eda.decision_environment: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ decision_env_name }}" description: "Example decision environment description" image_url: "{{ image_url }}" @@ -22,8 +23,9 @@ - name: Update decision environment name ansible.eda.decision_environment: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ decision_env_name }}" new_name: "{{ decision_env_name }}_new" description: "Example decision environment description" @@ -40,8 +42,9 @@ - name: Update decision environment again ansible.eda.decision_environment: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ decision_env_name }}_new" new_name: "{{ decision_env_name }}_new" description: "Example decision environment description" @@ -58,8 +61,9 @@ - name: Delete updated decision environment ansible.eda.decision_environment: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ decision_env_name }}_new" state: absent register: r diff --git a/tests/integration/targets/decision_environment_info/tasks/list.yml b/tests/integration/targets/decision_environment_info/tasks/list.yml index f248898c..7b677752 100644 --- a/tests/integration/targets/decision_environment_info/tasks/list.yml +++ b/tests/integration/targets/decision_environment_info/tasks/list.yml @@ -5,8 +5,9 @@ - name: Create decision environment ansible.eda.decision_environment: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ decision_env_name }}" description: "Example decision environment description" image_url: "{{ image_url }}" @@ -22,8 +23,9 @@ - name: List all decision environments in check mode ansible.eda.decision_environment_info: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" check_mode: true register: r @@ -36,8 +38,9 @@ - name: List all decision environments ansible.eda.decision_environment_info: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" register: r - name: Check if list decision environments @@ -49,8 +52,9 @@ - name: List a particular decision environment ansible.eda.decision_environment_info: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ decision_env_name }}" register: r @@ -64,8 +68,9 @@ - name: Delete decision environment ansible.eda.decision_environment: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ decision_env_name }}" state: absent register: r diff --git a/tests/integration/targets/decision_environment_info/tasks/main.yml b/tests/integration/targets/decision_environment_info/tasks/main.yml index 59a5fcf3..dc00a483 100644 --- a/tests/integration/targets/decision_environment_info/tasks/main.yml +++ b/tests/integration/targets/decision_environment_info/tasks/main.yml @@ -23,8 +23,9 @@ - name: Clean up - decision environment ansible.eda.decision_environment: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ item }}" state: absent loop: diff --git a/tests/integration/targets/project/tasks/create.yml b/tests/integration/targets/project/tasks/create.yml index 4f7e0bae..4bd201c2 100644 --- a/tests/integration/targets/project/tasks/create.yml +++ b/tests/integration/targets/project/tasks/create.yml @@ -5,8 +5,9 @@ - name: Create project in check mode ansible.eda.project: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ project_name }}" url: "{{ url }}" description: "Example project description" @@ -23,8 +24,9 @@ - name: Create project ansible.eda.project: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ project_name }}" url: "{{ url }}" description: "Example project description" @@ -40,8 +42,9 @@ - name: Create project again ansible.eda.project: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ project_name }}" url: "{{ url }}" description: "Example project description" @@ -57,8 +60,9 @@ - name: Delete project in check mode ansible.eda.project: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ project_name }}" state: absent check_mode: true @@ -72,8 +76,9 @@ - name: Delete project ansible.eda.project: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ project_name }}" state: absent register: r diff --git a/tests/integration/targets/project/tasks/delete.yml b/tests/integration/targets/project/tasks/delete.yml index 9656269c..458f27c8 100644 --- a/tests/integration/targets/project/tasks/delete.yml +++ b/tests/integration/targets/project/tasks/delete.yml @@ -5,6 +5,8 @@ - name: Delete operation without required name parameter ansible.eda.project: controller_host: "{{ controller_host }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" state: absent ignore_errors: true register: r @@ -18,8 +20,9 @@ - name: Delete non-existing project in check mode ansible.eda.project: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ project_name }}" state: absent check_mode: true @@ -33,8 +36,9 @@ - name: Delete non-existing project ansible.eda.project: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ project_name }}_ee" state: absent register: r diff --git a/tests/integration/targets/project/tasks/main.yml b/tests/integration/targets/project/tasks/main.yml index dfbf38bb..2930aed7 100644 --- a/tests/integration/targets/project/tasks/main.yml +++ b/tests/integration/targets/project/tasks/main.yml @@ -25,8 +25,9 @@ - name: Clean up - project ansible.eda.project: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ item }}" state: absent loop: diff --git a/tests/integration/targets/project/tasks/update.yml b/tests/integration/targets/project/tasks/update.yml index eace6723..2b82fae5 100644 --- a/tests/integration/targets/project/tasks/update.yml +++ b/tests/integration/targets/project/tasks/update.yml @@ -5,8 +5,9 @@ - name: Create project ansible.eda.project: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ project_name }}" url: "{{ url }}" description: "Example project description" @@ -22,8 +23,9 @@ - name: Update project name ansible.eda.project: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ project_name }}" url: "{{ url }}" new_name: "{{ project_name }}_new" @@ -40,8 +42,9 @@ - name: Update project again ansible.eda.project: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ project_name }}_new" new_name: "{{ project_name }}_new" description: "Example project description" @@ -58,8 +61,9 @@ - name: Delete updated project ansible.eda.project: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ project_name }}_new" state: absent register: r diff --git a/tests/integration/targets/project_info/tasks/create.yml b/tests/integration/targets/project_info/tasks/create.yml index f361411c..955f2454 100644 --- a/tests/integration/targets/project_info/tasks/create.yml +++ b/tests/integration/targets/project_info/tasks/create.yml @@ -5,8 +5,9 @@ - name: Create a project ansible.eda.project: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: Example description: "Example project description" url: "https://example.com/project1" diff --git a/tests/integration/targets/project_info/tasks/main.yml b/tests/integration/targets/project_info/tasks/main.yml index 53efce56..eb45420c 100644 --- a/tests/integration/targets/project_info/tasks/main.yml +++ b/tests/integration/targets/project_info/tasks/main.yml @@ -7,8 +7,9 @@ - name: List all projects in the given EDA Controller in check mode ansible.eda.project_info: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" check_mode: true register: r @@ -20,8 +21,9 @@ - name: List all projects in the given EDA Controller ansible.eda.project_info: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" register: r - name: Check if all the projects are returned @@ -32,8 +34,9 @@ - name: List a particular project in the given EDA Controller ansible.eda.project_info: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "Example" register: r @@ -46,8 +49,9 @@ - name: List a non-existing particular project in the given EDA Controller ansible.eda.project_info: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "Example2" register: r @@ -61,8 +65,9 @@ - name: Clean up - project ansible.eda.project: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ item }}" state: absent loop: diff --git a/tests/integration/targets/user/tasks/create.yml b/tests/integration/targets/user/tasks/create.yml index 1885d7f7..b1c310e2 100644 --- a/tests/integration/targets/user/tasks/create.yml +++ b/tests/integration/targets/user/tasks/create.yml @@ -5,8 +5,9 @@ - name: Create super user in check mode ansible.eda.user: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" username: "{{ user_name }}" first_name: "{{ first_name }}" last_name: "{{ last_name }}" @@ -25,8 +26,9 @@ - name: Create super user ansible.eda.user: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" username: "{{ user_name }}" first_name: "{{ first_name }}" last_name: "{{ last_name }}" @@ -44,8 +46,9 @@ - name: Create super user again ansible.eda.user: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" username: "{{ user_name }}" first_name: "{{ first_name }}" last_name: "{{ last_name }}" @@ -63,8 +66,9 @@ - name: Delete super user ansible.eda.user: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + vvalidate_certs: "{{ controller_verify_ssl }}" username: "{{ user_name }}" state: absent register: r @@ -77,8 +81,9 @@ - name: Create normal user in check mode ansible.eda.user: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" username: "{{ user_name }}" first_name: "{{ first_name }}" last_name: "{{ last_name }}" @@ -97,8 +102,9 @@ - name: Create normal user ansible.eda.user: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" username: "{{ user_name }}" first_name: "{{ first_name }}" last_name: "{{ last_name }}" @@ -116,8 +122,9 @@ - name: Create normal user again ansible.eda.user: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" username: "{{ user_name }}" first_name: "{{ first_name }}" last_name: "{{ last_name }}" @@ -135,8 +142,9 @@ - name: Delete normal user ansible.eda.user: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" username: "{{ user_name }}" state: absent register: r diff --git a/tests/integration/targets/user/tasks/main.yml b/tests/integration/targets/user/tasks/main.yml index dee345d8..08ebb423 100644 --- a/tests/integration/targets/user/tasks/main.yml +++ b/tests/integration/targets/user/tasks/main.yml @@ -21,8 +21,9 @@ - name: Clean up - user ansible.eda.project: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" name: "{{ item }}" state: absent loop: diff --git a/tests/integration/targets/user/tasks/update.yml b/tests/integration/targets/user/tasks/update.yml index 1270d6e1..c831616b 100644 --- a/tests/integration/targets/user/tasks/update.yml +++ b/tests/integration/targets/user/tasks/update.yml @@ -5,8 +5,9 @@ - name: Create super user ansible.eda.user: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" username: "{{ user_name }}" first_name: "{{ first_name }}" last_name: "{{ last_name }}" @@ -24,8 +25,9 @@ - name: Update super user ansible.eda.user: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" username: "{{ user_name }}" new_username: "{{ user_name }}_new" first_name: "{{ first_name }}_new" @@ -44,8 +46,9 @@ - name: Delete super user ansible.eda.user: controller_host: "{{ controller_host }}" - controller_username: "{{ controller_user }}" - validate_certs: "{{ validate_certs }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" username: "{{ user_name }}_new" state: absent register: r From 831d6e61737f48f72e52fab64ed910331f57cfd2 Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Tue, 20 Aug 2024 13:08:41 +0200 Subject: [PATCH 5/8] Use module_defaults Signed-off-by: Alina Buzachis --- .github/workflows/integration.yml | 2 +- plugins/module_utils/controller.py | 2 +- plugins/modules/activation.py | 4 +- plugins/modules/project_info.py | 9 +- .../targets/activation/tasks/main.yml | 51 +-- .../targets/controller_token/tasks/create.yml | 12 - .../targets/controller_token/tasks/main.yml | 14 +- .../targets/credential/tasks/main.yml | 354 +++++++++--------- .../targets/credential_type/tasks/main.yml | 345 +++++++++-------- .../decision_environment/tasks/create.yml | 20 - .../decision_environment/tasks/delete.yml | 12 - .../decision_environment/tasks/main.yml | 13 +- .../decision_environment/tasks/update.yml | 16 - .../decision_environment_info/tasks/list.yml | 20 - .../decision_environment_info/tasks/main.yml | 14 +- .../targets/project/tasks/create.yml | 20 - .../targets/project/tasks/delete.yml | 4 - .../targets/project/tasks/main.yml | 14 +- .../targets/project/tasks/update.yml | 16 - .../targets/project_info/tasks/create.yml | 4 - .../targets/project_info/tasks/main.yml | 30 +- .../integration/targets/user/tasks/create.yml | 32 -- tests/integration/targets/user/tasks/main.yml | 13 +- .../integration/targets/user/tasks/update.yml | 12 - 24 files changed, 409 insertions(+), 624 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index d79fc0be..d392c2c2 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -73,5 +73,5 @@ jobs: working-directory: ansible_collections/ansible/eda - name: Run integration tests - run: ansible-test integration project + run: ansible-test integration -v working-directory: ansible_collections/ansible/eda diff --git a/plugins/module_utils/controller.py b/plugins/module_utils/controller.py index c01211c6..a96a3b8a 100644 --- a/plugins/module_utils/controller.py +++ b/plugins/module_utils/controller.py @@ -91,7 +91,7 @@ def get_exactly_one( self, endpoint, name=None, **kwargs ) -> Optional[dict[str, bool]]: result = self.get_one_or_many( - endpoint, name=name, allow_none=False, want_one=True, **kwargs + endpoint, name=name, allow_none=True, want_one=True, **kwargs ) # typing: needed as get_one_or_many can also return lists, not expected # to reach this ever. diff --git a/plugins/modules/activation.py b/plugins/modules/activation.py index cdb48156..6cfe0c05 100644 --- a/plugins/modules/activation.py +++ b/plugins/modules/activation.py @@ -165,7 +165,7 @@ def lookup(module: AnsibleModule, controller: Controller, endpoint, name): def create_params(module: AnsibleModule, controller: Controller) -> dict[str, Any]: - activation_params = {} + activation_params: dict[str, Any] = {} # Get the project id project_id = None @@ -303,7 +303,7 @@ def main() -> None: argument_spec.update(AUTH_ARGSPEC) required_if = [ - ("state", "present", ("name", "rulebook_name", "decision_environment_name")) + ("state", "present", ("name", "rulebook_name", "decision_environment_name", "organization_name")) ] module = AnsibleModule( diff --git a/plugins/modules/project_info.py b/plugins/modules/project_info.py index 94034e09..983d9d05 100644 --- a/plugins/modules/project_info.py +++ b/plugins/modules/project_info.py @@ -80,6 +80,7 @@ # pylint: disable=relative-beyond-top-level from ..module_utils.arguments import AUTH_ARGSPEC from ..module_utils.client import Client +from ..module_utils.common import to_list_of_dict from ..module_utils.controller import Controller from ..module_utils.errors import EDAError @@ -106,8 +107,6 @@ def main() -> None: project_name = module.params.get("name") - ret: list[Any] = [] - try: result = controller.get_one_or_many( project_endpoint, name=project_name, want_one=False @@ -115,11 +114,7 @@ def main() -> None: except EDAError as eda_err: module.fail_json(msg=str(eda_err)) - if result is None: - ret = [] - if not isinstance(result, list): - ret = [result] - module.exit_json(projects=ret) + module.exit_json(projects=to_list_of_dict(result)) if __name__ == "__main__": diff --git a/tests/integration/targets/activation/tasks/main.yml b/tests/integration/targets/activation/tasks/main.yml index adf74914..2bd6d091 100644 --- a/tests/integration/targets/activation/tasks/main.yml +++ b/tests/integration/targets/activation/tasks/main.yml @@ -1,14 +1,12 @@ --- -- block: - - name: Set defaults for credentials - set_fact: - credential_defaults: &credential_defaults - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - controller_host: "{{ controller_host }}" - validate_certs: false - no_log: true - +- name: Rulebook activation integration tests + module_defaults: + group/ansible.eda.eda: + controller_host: "{{ controller_host }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" + block: - name: Generate a random_string for the test set_fact: random_string: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" @@ -34,7 +32,6 @@ - name: Create an AWX controller token ansible.eda.controller_token: - <<: *credential_defaults name: "{{ awx_token_name }}" description: "A test AWX controller token description" token: "{{ token_value }}" @@ -42,7 +39,6 @@ - name: Create a new credential type ansible.eda.credential_type: - <<: *credential_defaults name: "{{ credential_type_name }}" state: present description: "A test credential type" @@ -87,10 +83,10 @@ - name: Read the generated key set_fact: ssh_key_data: "{{ lookup('file', tempdir.stdout + '/id_rsa') }}" + no_log: true - name: Create a new SCM credential ansible.eda.credential: - <<: *credential_defaults name: "{{ credential_name }}" state: present credential_type_name: Source Control @@ -110,7 +106,6 @@ - name: Create a new project ansible.eda.project: - <<: *credential_defaults name: "{{ project_name }}" description: "Test Project Description" url: "{{ scm_url }}" @@ -127,7 +122,6 @@ - name: Create a new decision environment ansible.eda.decision_environment: - <<: *credential_defaults name: "{{ decision_env_name }}" description: "Test Decision Environment Description" credential: "{{ credential_name }}" @@ -137,7 +131,6 @@ - name: Create a new rulebook activation in check mode ansible.eda.activation: - <<: *credential_defaults name: "{{ activation_name }}" description: "Example Activation description" project_name: "{{ project_name }}" @@ -156,7 +149,6 @@ - name: Create a new rulebook activation ansible.eda.activation: - <<: *credential_defaults name: "{{ activation_name }}" description: "Example Activation description" project_name: "{{ project_name }}" @@ -174,7 +166,6 @@ - name: Create a new rulebook activation again ansible.eda.activation: - <<: *credential_defaults name: "{{ activation_name }}" description: "Example Activation description" project_name: "{{ project_name }}" @@ -193,16 +184,13 @@ - name: Get information about the rulebook activation ansible.eda.activation_info: - <<: *credential_defaults name: "{{ activation_name }}" - name: List all the rulebook activations ansible.eda.activation_info: - <<: *credential_defaults - name: Delete project ansible.eda.project: - <<: *credential_defaults name: "{{ project_name }}" state: absent register: project_deletion @@ -215,7 +203,6 @@ - name: Delete credential ansible.eda.credential: - <<: *credential_defaults name: "{{ credential_name }}" state: absent register: credential_deletion @@ -228,49 +215,43 @@ - name: Delete rulebook activation ansible.eda.activation: - <<: *credential_defaults name: "{{ activation_name }}" state: absent always: - name: Delete AWX token ansible.eda.controller_token: - <<: *credential_defaults name: "{{ awx_token_name }}" state: absent ignore_errors: true - name: Delete project ansible.eda.project: - <<: *credential_defaults name: "{{ project_name }}" state: absent ignore_errors: true - - name: Delete decision environment - ansible.eda.decision_environment: - <<: *credential_defaults - name: "{{ decision_env_name }}" - state: absent - ignore_errors: true - - name: Delete credential ansible.eda.credential: - <<: *credential_defaults name: "{{ credential_name }}" state: absent ignore_errors: true - name: Delete credential type ansible.eda.credential_type: - <<: *credential_defaults name: "{{ credential_type_name }}" state: absent ignore_errors: true - name: Delete rulebook activation ansible.eda.activation: - <<: *credential_defaults name: "{{ activation_name }}" state: absent ignore_errors: true + + - name: Delete decision environment + ansible.eda.decision_environment: + name: "{{ decision_env_name }}" + state: absent + ignore_errors: true + diff --git a/tests/integration/targets/controller_token/tasks/create.yml b/tests/integration/targets/controller_token/tasks/create.yml index 0e22d5d7..edcaabe4 100644 --- a/tests/integration/targets/controller_token/tasks/create.yml +++ b/tests/integration/targets/controller_token/tasks/create.yml @@ -4,10 +4,6 @@ - name: Create controller token in check mode ansible.eda.controller_token: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ controller_token_name }}" description: "Example controller token description" token: "TOKEN_VALUE" @@ -23,10 +19,6 @@ - name: Create controller token ansible.eda.controller_token: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ controller_token_name }}" description: "Example controller token description" token: "TOKEN_VALUE" @@ -42,10 +34,6 @@ - name: Create controller token again ansible.eda.controller_token: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ controller_token_name }}" description: "Example controller token description" token: "TOKEN_VALUE" diff --git a/tests/integration/targets/controller_token/tasks/main.yml b/tests/integration/targets/controller_token/tasks/main.yml index 3b0a3c76..8ce95371 100644 --- a/tests/integration/targets/controller_token/tasks/main.yml +++ b/tests/integration/targets/controller_token/tasks/main.yml @@ -2,7 +2,15 @@ # Copyright: Contributors to the Ansible project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -- block: +- name: Controller token integration tests + module_defaults: + group/ansible.eda.eda: + controller_host: "{{ controller_host }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" + + block: - name: Generate a random_string for the test set_fact: random_string: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" @@ -21,10 +29,6 @@ always: - name: Clean up - controller token ansible.eda.controller_token: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ item }}" state: absent loop: diff --git a/tests/integration/targets/credential/tasks/main.yml b/tests/integration/targets/credential/tasks/main.yml index 9af282a1..d537a994 100644 --- a/tests/integration/targets/credential/tasks/main.yml +++ b/tests/integration/targets/credential/tasks/main.yml @@ -1,193 +1,178 @@ --- -- block: - - set_fact: - credential_defaults: &credential_defaults - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - controller_host: "{{ controller_host }}" - validate_certs: false - no_log: true - - - name: Generate a random_string for the test - set_fact: - random_string: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - when: random_string is not defined - - - name: Generate a ID for the test - set_fact: - test_id: "{{ random_string | to_uuid }}" - when: test_id is not defined - - - name: Define variables for credential and project - set_fact: - credential_name: "Test_Credential_{{ test_id }}" - new_credential_name: "New_Test_Credential_{{ test_id }}" - credential_type_name: "Test_CredentialType_{{ test_id }}" - - # CREATE - - name: Create credential type - ansible.eda.credential_type: - <<: *credential_defaults - name: "{{ credential_type_name }}" - state: present - description: "A test credential type" - inputs: - fields: - - id: "field1" - type: "string" - label: "Field 5" - injectors: - extra_vars: - field1: "field1" - - - name: Create credential in check mode - ansible.eda.credential: - <<: *credential_defaults - state: present - name: "{{ credential_name }}" - description: "This is a test credential" - credential_type_name: "{{ credential_type_name }}" - inputs: - field1: "field1" - organization_name: Default - check_mode: true - register: _result - - - name: Check credential creation in check mode - assert: - that: - - _result.changed - - - name: Create credential - ansible.eda.credential: - <<: *credential_defaults - state: present - name: "{{ credential_name }}" - description: "This is a test credential" - credential_type_name: "{{ credential_type_name }}" - inputs: - field1: "field1" - organization_name: Default - register: _result - - - name: Check credential creation - assert: - that: - - _result.changed - - - name: Create credential again - ansible.eda.credential: - <<: *credential_defaults - state: present - name: "{{ credential_name }}" - description: "This is a test credential" - credential_type_name: "{{ credential_type_name }}" - inputs: - field1: "field1" - organization_name: Default - register: _result - - # [WARNING]: The field inputs of unknown 3 has encrypted data and may inaccurately report task is changed. - - name: Check credential is not created again - assert: - that: - - not _result.changed - ignore_errors: true - - - name: Get info about a credential - ansible.eda.credential_info: - <<: *credential_defaults - name: "{{ credential_name }}" - - # UPDATE - - name: Update credential name - ansible.eda.credential: - <<: *credential_defaults - state: present - name: "{{ new_credential_name }}" - description: "This is a test credential" - credential_type_name: "{{ credential_type_name }}" - inputs: - field1: "field1" - organization_name: Default - register: _result - - - name: Check credential update - assert: - that: - - _result.changed - - - name: Update credential again - ansible.eda.credential: - <<: *credential_defaults - state: present - name: "{{ new_credential_name }}" - description: "This is a test credential" - credential_type_name: "{{ credential_type_name }}" - inputs: +- name: Credential integration tests + module_defaults: + group/ansible.eda.eda: + controller_host: "{{ controller_host }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" + block: + - name: Generate a random_string for the test + set_fact: + random_string: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + when: random_string is not defined + + - name: Generate a ID for the test + set_fact: + test_id: "{{ random_string | to_uuid }}" + when: test_id is not defined + + - name: Define variables for credential and project + set_fact: + credential_name: "Test_Credential_{{ test_id }}" + new_credential_name: "New_Test_Credential_{{ test_id }}" + credential_type_name: "Test_CredentialType_{{ test_id }}" + + # CREATE + - name: Create credential type + ansible.eda.credential_type: + name: "{{ credential_type_name }}" + state: present + description: "A test credential type" + inputs: + fields: + - id: "field1" + type: "string" + label: "Field 5" + injectors: + extra_vars: field1: "field1" - organization_name: Default - register: _result - - # [WARNING]: The field inputs of unknown 3 has encrypted data and may inaccurately report task is changed. - - name: Check credential is not updated again - assert: - that: - - not _result.changed - ignore_errors: true - - - name: Get info about credential - ansible.eda.credential_info: - <<: *credential_defaults - name: "{{ new_credential_name }}" - - - name: List all credentials - ansible.eda.credential_info: - <<: *credential_defaults - - # DELETE - - name: Delete operation type without required name parameter - ansible.eda.credential: - <<: *credential_defaults - state: absent - ignore_errors: true - register: _result - - - name: Check if credential name is required - assert: - that: - - _result.failed - - "'missing required arguments: name' in _result.msg" - - - name: Delete non-existing credential in check mode - ansible.eda.credential: - <<: *credential_defaults - name: "Example2" - state: absent - check_mode: true - register: _result - - - name: Check if delete non-existing credential in check mode - assert: - that: - - not _result.changed - - - name: Delete credential - ansible.eda.credential: - <<: *credential_defaults - name: "{{ new_credential_name }}" - state: absent - register: _result - - - name: Check if delete non-existing credential - assert: - that: - - _result.changed + - name: Create credential in check mode + ansible.eda.credential: + state: present + name: "{{ credential_name }}" + description: "This is a test credential" + credential_type_name: "{{ credential_type_name }}" + inputs: + field1: "field1" + organization_name: Default + check_mode: true + register: _result + + - name: Check credential creation in check mode + assert: + that: + - _result.changed + + - name: Create credential + ansible.eda.credential: + state: present + name: "{{ credential_name }}" + description: "This is a test credential" + credential_type_name: "{{ credential_type_name }}" + inputs: + field1: "field1" + organization_name: Default + register: _result + + - name: Check credential creation + assert: + that: + - _result.changed + + - name: Create credential again + ansible.eda.credential: + state: present + name: "{{ credential_name }}" + description: "This is a test credential" + credential_type_name: "{{ credential_type_name }}" + inputs: + field1: "field1" + organization_name: Default + register: _result + + # [WARNING]: The field inputs of unknown 3 has encrypted data and may inaccurately report task is changed. + - name: Check credential is not created again + assert: + that: + - not _result.changed + ignore_errors: true + + - name: Get info about a credential + ansible.eda.credential_info: + name: "{{ credential_name }}" + + # UPDATE + - name: Update credential name + ansible.eda.credential: + state: present + name: "{{ new_credential_name }}" + description: "This is a test credential" + credential_type_name: "{{ credential_type_name }}" + inputs: + field1: "field1" + organization_name: Default + register: _result + + - name: Check credential update + assert: + that: + - _result.changed + + - name: Update credential again + ansible.eda.credential: + state: present + name: "{{ new_credential_name }}" + description: "This is a test credential" + credential_type_name: "{{ credential_type_name }}" + inputs: + field1: "field1" + organization_name: Default + register: _result + + # [WARNING]: The field inputs of unknown 3 has encrypted data and may inaccurately report task is changed. + - name: Check credential is not updated again + assert: + that: + - not _result.changed + ignore_errors: true + + - name: Get info about credential + ansible.eda.credential_info: + name: "{{ new_credential_name }}" + + - name: List all credentials + ansible.eda.credential_info: + + # DELETE + - name: Delete operation type without required name parameter + ansible.eda.credential: + state: absent + ignore_errors: true + register: _result + + - name: Check if credential name is required + assert: + that: + - _result.failed + - "'missing required arguments: name' in _result.msg" + + - name: Delete non-existing credential in check mode + ansible.eda.credential: + name: "Example2" + state: absent + check_mode: true + register: _result + + - name: Check if delete non-existing credential in check mode + assert: + that: + - not _result.changed + + - name: Delete credential + ansible.eda.credential: + name: "{{ new_credential_name }}" + state: absent + register: _result + + - name: Check if delete non-existing credential + assert: + that: + - _result.changed always: - name: Clean up - credential ansible.eda.credential: - <<: *credential_defaults name: "{{ item }}" state: absent loop: @@ -197,7 +182,6 @@ - name: Clean up - credential type ansible.eda.credential_type: - <<: *credential_defaults name: "{{ credential_type_name }}" state: absent ignore_errors: true diff --git a/tests/integration/targets/credential_type/tasks/main.yml b/tests/integration/targets/credential_type/tasks/main.yml index 503ed34f..a3f1a759 100644 --- a/tests/integration/targets/credential_type/tasks/main.yml +++ b/tests/integration/targets/credential_type/tasks/main.yml @@ -1,186 +1,175 @@ --- -- block: - - set_fact: - credential_defaults: &credential_defaults - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - controller_host: "{{ controller_host }}" - validate_certs: false - no_log: true - - - name: Generate a random_string for the test - set_fact: - random_string: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - when: random_string is not defined - - - name: Generate a ID for the test - set_fact: - test_id: "{{ random_string | to_uuid }}" - when: test_id is not defined - - - name: Define variables for credential and project - set_fact: - credential_type_name: "Test_CredentialType_{{ test_id }}" - new_credential_type_name: "New_Test_CredentialType_{{ test_id }}" - - # CREATE - - name: Create credential type in check mode - ansible.eda.credential_type: - <<: *credential_defaults - name: "{{ credential_type_name }}" - state: present - description: "A test credential type" - inputs: - fields: - - id: "field1" - type: "string" - label: "Field 5" - injectors: - extra_vars: - field1: "field1" - check_mode: true - register: _result - - - name: Check credential type creation in check mode - assert: - that: - - _result.changed - - - name: Create credential type - ansible.eda.credential_type: - <<: *credential_defaults - name: "{{ credential_type_name }}" - state: present - description: "A test credential type" - inputs: - fields: - - id: "field1" - type: "string" - label: "Field 5" - injectors: - extra_vars: - field1: "field1" - register: _result - - - name: Check credential type creation - assert: - that: - - _result.changed - - - name: Create credential type again - ansible.eda.credential_type: - <<: *credential_defaults - name: "{{ credential_type_name }}" - state: present - description: "A test credential type" - inputs: - fields: - - id: "field1" - type: "string" - label: "Field 5" - injectors: - extra_vars: - field1: "field1" - register: _result - - - name: Check credential type is not created again - assert: - that: - - not _result.changed - - - name: Get info about a credential type - ansible.eda.credential_type_info: - <<: *credential_defaults - name: "{{ credential_type_name }}" - - # UPDATE - - name: Update credential type name - ansible.eda.credential_type: - <<: *credential_defaults - name: "{{ credential_type_name }}" - new_name: "{{ new_credential_type_name }}" - state: present - description: "A test credential type" - inputs: - fields: - - id: "field1" - type: "string" - label: "Field 5" - injectors: - extra_vars: - field1: "field1" - register: _result - - - name: Check credential type update - assert: - that: - - _result.changed - - - name: Update credential type again - ansible.eda.credential_type: - <<: *credential_defaults - name: "{{ new_credential_type_name }}" - new_name: "{{ new_credential_type_name }}" - state: present - description: "A test credential type" - inputs: - fields: - - id: "field1" - type: "string" - label: "Field 5" - injectors: - extra_vars: - field1: "field1" - register: _result - - - name: Check credential type is not updated again - assert: - that: - - not _result.changed - - # DELETE - - name: Delete operation type without required name parameter - ansible.eda.credential_type: - <<: *credential_defaults - state: absent - ignore_errors: true - register: _result - - - name: Check if credential type name is required - assert: - that: - - _result.failed - - "'missing required arguments: name' in _result.msg" - - - name: Delete non-existing credential type in check mode - ansible.eda.credential_type: - <<: *credential_defaults - name: "Example2" - state: absent - check_mode: true - register: _result - - - name: Check if delete non-existing credential type in check mode - assert: - that: - - not _result.changed - - - name: Delete credential type - ansible.eda.credential_type: - <<: *credential_defaults - name: "{{ new_credential_type_name }}" - state: absent - register: _result - - - name: Check if delete non-existing credential type - assert: - that: - - _result.changed +- name: Credential type integration tests + module_defaults: + group/ansible.eda.eda: + controller_host: "{{ controller_host }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" + block: + - name: Generate a random_string for the test + set_fact: + random_string: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + when: random_string is not defined + + - name: Generate a ID for the test + set_fact: + test_id: "{{ random_string | to_uuid }}" + when: test_id is not defined + + - name: Define variables for credential and project + set_fact: + credential_type_name: "Test_CredentialType_{{ test_id }}" + new_credential_type_name: "New_Test_CredentialType_{{ test_id }}" + + # CREATE + - name: Create credential type in check mode + ansible.eda.credential_type: + name: "{{ credential_type_name }}" + state: present + description: "A test credential type" + inputs: + fields: + - id: "field1" + type: "string" + label: "Field 5" + injectors: + extra_vars: + field1: "field1" + check_mode: true + register: _result + + - name: Check credential type creation in check mode + assert: + that: + - _result.changed + + - name: Create credential type + ansible.eda.credential_type: + name: "{{ credential_type_name }}" + state: present + description: "A test credential type" + inputs: + fields: + - id: "field1" + type: "string" + label: "Field 5" + injectors: + extra_vars: + field1: "field1" + register: _result + + - name: Check credential type creation + assert: + that: + - _result.changed + + - name: Create credential type again + ansible.eda.credential_type: + name: "{{ credential_type_name }}" + state: present + description: "A test credential type" + inputs: + fields: + - id: "field1" + type: "string" + label: "Field 5" + injectors: + extra_vars: + field1: "field1" + register: _result + + - name: Check credential type is not created again + assert: + that: + - not _result.changed + + - name: Get info about a credential type + ansible.eda.credential_type_info: + name: "{{ credential_type_name }}" + + # UPDATE + - name: Update credential type name + ansible.eda.credential_type: + name: "{{ credential_type_name }}" + new_name: "{{ new_credential_type_name }}" + state: present + description: "A test credential type" + inputs: + fields: + - id: "field1" + type: "string" + label: "Field 5" + injectors: + extra_vars: + field1: "field1" + register: _result + + - name: Check credential type update + assert: + that: + - _result.changed + + - name: Update credential type again + ansible.eda.credential_type: + name: "{{ new_credential_type_name }}" + new_name: "{{ new_credential_type_name }}" + state: present + description: "A test credential type" + inputs: + fields: + - id: "field1" + type: "string" + label: "Field 5" + injectors: + extra_vars: + field1: "field1" + register: _result + + - name: Check credential type is not updated again + assert: + that: + - not _result.changed + + # DELETE + - name: Delete operation type without required name parameter + ansible.eda.credential_type: + state: absent + ignore_errors: true + register: _result + + - name: Check if credential type name is required + assert: + that: + - _result.failed + - "'missing required arguments: name' in _result.msg" + + - name: Delete non-existing credential type in check mode + ansible.eda.credential_type: + name: "Example2" + state: absent + check_mode: true + register: _result + + - name: Check if delete non-existing credential type in check mode + assert: + that: + - not _result.changed + + - name: Delete credential type + ansible.eda.credential_type: + name: "{{ new_credential_type_name }}" + state: absent + register: _result + + - name: Check if delete non-existing credential type + assert: + that: + - _result.changed always: - name: Clean up - credential type ansible.eda.credential_type: - <<: *credential_defaults name: "{{ item }}" state: absent loop: diff --git a/tests/integration/targets/decision_environment/tasks/create.yml b/tests/integration/targets/decision_environment/tasks/create.yml index 83fb976b..037ce439 100644 --- a/tests/integration/targets/decision_environment/tasks/create.yml +++ b/tests/integration/targets/decision_environment/tasks/create.yml @@ -4,10 +4,6 @@ - name: Create decision environment in check mode ansible.eda.decision_environment: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ decision_env_name }}" description: "Example decision environment description" image_url: "{{ image_url }}" @@ -23,10 +19,6 @@ - name: Create decision environment ansible.eda.decision_environment: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ decision_env_name }}" description: "Example decision environment description" image_url: "{{ image_url }}" @@ -41,10 +33,6 @@ - name: Create decision environment again ansible.eda.decision_environment: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ decision_env_name }}" description: "Example decision environment description" image_url: "{{ image_url }}" @@ -59,10 +47,6 @@ - name: Delete decision environment in check mode ansible.eda.decision_environment: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ decision_env_name }}" state: absent check_mode: true @@ -75,10 +59,6 @@ - name: Delete decision environment ansible.eda.decision_environment: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ decision_env_name }}" state: absent register: r diff --git a/tests/integration/targets/decision_environment/tasks/delete.yml b/tests/integration/targets/decision_environment/tasks/delete.yml index 399c1657..b5e765b7 100644 --- a/tests/integration/targets/decision_environment/tasks/delete.yml +++ b/tests/integration/targets/decision_environment/tasks/delete.yml @@ -4,10 +4,6 @@ - name: Delete operation without required name parameter ansible.eda.decision_environment: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" state: absent ignore_errors: true register: r @@ -20,10 +16,6 @@ - name: Delete non-existing decision environment in check mode ansible.eda.decision_environment: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: Example state: absent check_mode: true @@ -36,10 +28,6 @@ - name: Delete non-existing decision environment ansible.eda.decision_environment: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: Example state: absent register: r diff --git a/tests/integration/targets/decision_environment/tasks/main.yml b/tests/integration/targets/decision_environment/tasks/main.yml index 4c0687c1..b4ffc8d5 100644 --- a/tests/integration/targets/decision_environment/tasks/main.yml +++ b/tests/integration/targets/decision_environment/tasks/main.yml @@ -2,7 +2,14 @@ # Copyright: Contributors to the Ansible project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -- block: +- name: Decision environment integration tests + module_defaults: + group/ansible.eda.eda: + controller_host: "{{ controller_host }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" + block: - name: Generate a random_string for the test set_fact: random_string: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" @@ -24,10 +31,6 @@ always: - name: Clean up - decision environment ansible.eda.decision_environment: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ item }}" state: absent loop: diff --git a/tests/integration/targets/decision_environment/tasks/update.yml b/tests/integration/targets/decision_environment/tasks/update.yml index f7a01d7b..c324def0 100644 --- a/tests/integration/targets/decision_environment/tasks/update.yml +++ b/tests/integration/targets/decision_environment/tasks/update.yml @@ -4,10 +4,6 @@ - name: Create decision environment ansible.eda.decision_environment: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ decision_env_name }}" description: "Example decision environment description" image_url: "{{ image_url }}" @@ -22,10 +18,6 @@ - name: Update decision environment name ansible.eda.decision_environment: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ decision_env_name }}" new_name: "{{ decision_env_name }}_new" description: "Example decision environment description" @@ -41,10 +33,6 @@ - name: Update decision environment again ansible.eda.decision_environment: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ decision_env_name }}_new" new_name: "{{ decision_env_name }}_new" description: "Example decision environment description" @@ -60,10 +48,6 @@ - name: Delete updated decision environment ansible.eda.decision_environment: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ decision_env_name }}_new" state: absent register: r diff --git a/tests/integration/targets/decision_environment_info/tasks/list.yml b/tests/integration/targets/decision_environment_info/tasks/list.yml index 7b677752..cef195ad 100644 --- a/tests/integration/targets/decision_environment_info/tasks/list.yml +++ b/tests/integration/targets/decision_environment_info/tasks/list.yml @@ -4,10 +4,6 @@ - name: Create decision environment ansible.eda.decision_environment: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ decision_env_name }}" description: "Example decision environment description" image_url: "{{ image_url }}" @@ -22,10 +18,6 @@ - name: List all decision environments in check mode ansible.eda.decision_environment_info: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" check_mode: true register: r @@ -37,10 +29,6 @@ - name: List all decision environments ansible.eda.decision_environment_info: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" register: r - name: Check if list decision environments @@ -51,10 +39,6 @@ - name: List a particular decision environment ansible.eda.decision_environment_info: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ decision_env_name }}" register: r @@ -67,10 +51,6 @@ - name: Delete decision environment ansible.eda.decision_environment: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ decision_env_name }}" state: absent register: r diff --git a/tests/integration/targets/decision_environment_info/tasks/main.yml b/tests/integration/targets/decision_environment_info/tasks/main.yml index dc00a483..bbae844c 100644 --- a/tests/integration/targets/decision_environment_info/tasks/main.yml +++ b/tests/integration/targets/decision_environment_info/tasks/main.yml @@ -2,7 +2,15 @@ # Copyright: Contributors to the Ansible project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -- block: +- name: Decision environment info module integration tests + module_defaults: + group/ansible.eda.eda: + controller_host: "{{ controller_host }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" + + block: - name: Generate a random_string for the test set_fact: random_string: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" @@ -22,10 +30,6 @@ always: - name: Clean up - decision environment ansible.eda.decision_environment: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ item }}" state: absent loop: diff --git a/tests/integration/targets/project/tasks/create.yml b/tests/integration/targets/project/tasks/create.yml index 4bd201c2..ffda25f9 100644 --- a/tests/integration/targets/project/tasks/create.yml +++ b/tests/integration/targets/project/tasks/create.yml @@ -4,10 +4,6 @@ - name: Create project in check mode ansible.eda.project: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ project_name }}" url: "{{ url }}" description: "Example project description" @@ -23,10 +19,6 @@ - name: Create project ansible.eda.project: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ project_name }}" url: "{{ url }}" description: "Example project description" @@ -41,10 +33,6 @@ - name: Create project again ansible.eda.project: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ project_name }}" url: "{{ url }}" description: "Example project description" @@ -59,10 +47,6 @@ - name: Delete project in check mode ansible.eda.project: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ project_name }}" state: absent check_mode: true @@ -75,10 +59,6 @@ - name: Delete project ansible.eda.project: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ project_name }}" state: absent register: r diff --git a/tests/integration/targets/project/tasks/delete.yml b/tests/integration/targets/project/tasks/delete.yml index 458f27c8..fbcf1a68 100644 --- a/tests/integration/targets/project/tasks/delete.yml +++ b/tests/integration/targets/project/tasks/delete.yml @@ -35,10 +35,6 @@ - name: Delete non-existing project ansible.eda.project: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ project_name }}_ee" state: absent register: r diff --git a/tests/integration/targets/project/tasks/main.yml b/tests/integration/targets/project/tasks/main.yml index 2930aed7..a7fc5193 100644 --- a/tests/integration/targets/project/tasks/main.yml +++ b/tests/integration/targets/project/tasks/main.yml @@ -1,8 +1,14 @@ --- # Copyright: Contributors to the Ansible project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -- block: +- name: Project integration tests + module_defaults: + group/ansible.eda.eda: + controller_host: "{{ controller_host }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" + block: - name: Generate a random_string for the test set_fact: random_string: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" @@ -24,10 +30,6 @@ always: - name: Clean up - project ansible.eda.project: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ item }}" state: absent loop: diff --git a/tests/integration/targets/project/tasks/update.yml b/tests/integration/targets/project/tasks/update.yml index 2b82fae5..7bc73b7a 100644 --- a/tests/integration/targets/project/tasks/update.yml +++ b/tests/integration/targets/project/tasks/update.yml @@ -4,10 +4,6 @@ - name: Create project ansible.eda.project: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ project_name }}" url: "{{ url }}" description: "Example project description" @@ -22,10 +18,6 @@ - name: Update project name ansible.eda.project: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ project_name }}" url: "{{ url }}" new_name: "{{ project_name }}_new" @@ -41,10 +33,6 @@ - name: Update project again ansible.eda.project: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ project_name }}_new" new_name: "{{ project_name }}_new" description: "Example project description" @@ -60,10 +48,6 @@ - name: Delete updated project ansible.eda.project: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ project_name }}_new" state: absent register: r diff --git a/tests/integration/targets/project_info/tasks/create.yml b/tests/integration/targets/project_info/tasks/create.yml index 955f2454..36e1d0ca 100644 --- a/tests/integration/targets/project_info/tasks/create.yml +++ b/tests/integration/targets/project_info/tasks/create.yml @@ -4,10 +4,6 @@ - name: Create a project ansible.eda.project: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: Example description: "Example project description" url: "https://example.com/project1" diff --git a/tests/integration/targets/project_info/tasks/main.yml b/tests/integration/targets/project_info/tasks/main.yml index eb45420c..b8f05605 100644 --- a/tests/integration/targets/project_info/tasks/main.yml +++ b/tests/integration/targets/project_info/tasks/main.yml @@ -2,14 +2,18 @@ # Copyright: Contributors to the Ansible project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -- block: +- name: Project info module integration tests + module_defaults: + group/ansible.eda.eda: + controller_host: "{{ controller_host }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" + + block: - include_tasks: create.yml - name: List all projects in the given EDA Controller in check mode ansible.eda.project_info: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" check_mode: true register: r @@ -20,10 +24,6 @@ - name: List all projects in the given EDA Controller ansible.eda.project_info: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" register: r - name: Check if all the projects are returned @@ -33,10 +33,6 @@ - name: List a particular project in the given EDA Controller ansible.eda.project_info: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "Example" register: r @@ -48,10 +44,6 @@ - name: List a non-existing particular project in the given EDA Controller ansible.eda.project_info: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "Example2" register: r @@ -64,10 +56,6 @@ always: - name: Clean up - project ansible.eda.project: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ item }}" state: absent loop: diff --git a/tests/integration/targets/user/tasks/create.yml b/tests/integration/targets/user/tasks/create.yml index b1c310e2..3fc26628 100644 --- a/tests/integration/targets/user/tasks/create.yml +++ b/tests/integration/targets/user/tasks/create.yml @@ -4,10 +4,6 @@ - name: Create super user in check mode ansible.eda.user: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" username: "{{ user_name }}" first_name: "{{ first_name }}" last_name: "{{ last_name }}" @@ -25,10 +21,6 @@ - name: Create super user ansible.eda.user: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" username: "{{ user_name }}" first_name: "{{ first_name }}" last_name: "{{ last_name }}" @@ -45,10 +37,6 @@ - name: Create super user again ansible.eda.user: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" username: "{{ user_name }}" first_name: "{{ first_name }}" last_name: "{{ last_name }}" @@ -65,10 +53,6 @@ - name: Delete super user ansible.eda.user: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - vvalidate_certs: "{{ controller_verify_ssl }}" username: "{{ user_name }}" state: absent register: r @@ -80,10 +64,6 @@ - name: Create normal user in check mode ansible.eda.user: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" username: "{{ user_name }}" first_name: "{{ first_name }}" last_name: "{{ last_name }}" @@ -101,10 +81,6 @@ - name: Create normal user ansible.eda.user: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" username: "{{ user_name }}" first_name: "{{ first_name }}" last_name: "{{ last_name }}" @@ -121,10 +97,6 @@ - name: Create normal user again ansible.eda.user: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" username: "{{ user_name }}" first_name: "{{ first_name }}" last_name: "{{ last_name }}" @@ -141,10 +113,6 @@ - name: Delete normal user ansible.eda.user: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" username: "{{ user_name }}" state: absent register: r diff --git a/tests/integration/targets/user/tasks/main.yml b/tests/integration/targets/user/tasks/main.yml index 08ebb423..b1303b6e 100644 --- a/tests/integration/targets/user/tasks/main.yml +++ b/tests/integration/targets/user/tasks/main.yml @@ -2,7 +2,14 @@ # Copyright: Contributors to the Ansible project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -- block: +- name: User integration tests + module_defaults: + group/ansible.eda.eda: + controller_host: "{{ controller_host }}" + controller_username: "{{ controller_username }}" + controller_password: "{{ controller_password }}" + validate_certs: "{{ controller_verify_ssl }}" + block: - name: Generate a random_string for the test set_fact: random_string: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" @@ -20,10 +27,6 @@ always: - name: Clean up - user ansible.eda.project: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" name: "{{ item }}" state: absent loop: diff --git a/tests/integration/targets/user/tasks/update.yml b/tests/integration/targets/user/tasks/update.yml index c831616b..f77226f0 100644 --- a/tests/integration/targets/user/tasks/update.yml +++ b/tests/integration/targets/user/tasks/update.yml @@ -4,10 +4,6 @@ - name: Create super user ansible.eda.user: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" username: "{{ user_name }}" first_name: "{{ first_name }}" last_name: "{{ last_name }}" @@ -24,10 +20,6 @@ - name: Update super user ansible.eda.user: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" username: "{{ user_name }}" new_username: "{{ user_name }}_new" first_name: "{{ first_name }}_new" @@ -45,10 +37,6 @@ - name: Delete super user ansible.eda.user: - controller_host: "{{ controller_host }}" - controller_username: "{{ controller_username }}" - controller_password: "{{ controller_password }}" - validate_certs: "{{ controller_verify_ssl }}" username: "{{ user_name }}_new" state: absent register: r From 4a2fca24cba22887d77e3dd8617d75d42c333684 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 12:11:19 +0000 Subject: [PATCH 6/8] chore: auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- plugins/modules/activation.py | 6 +++++- tests/integration/targets/activation/tasks/main.yml | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/modules/activation.py b/plugins/modules/activation.py index 6cfe0c05..2cf5cbab 100644 --- a/plugins/modules/activation.py +++ b/plugins/modules/activation.py @@ -303,7 +303,11 @@ def main() -> None: argument_spec.update(AUTH_ARGSPEC) required_if = [ - ("state", "present", ("name", "rulebook_name", "decision_environment_name", "organization_name")) + ( + "state", + "present", + ("name", "rulebook_name", "decision_environment_name", "organization_name"), + ) ] module = AnsibleModule( diff --git a/tests/integration/targets/activation/tasks/main.yml b/tests/integration/targets/activation/tasks/main.yml index 2bd6d091..cc68c315 100644 --- a/tests/integration/targets/activation/tasks/main.yml +++ b/tests/integration/targets/activation/tasks/main.yml @@ -254,4 +254,3 @@ name: "{{ decision_env_name }}" state: absent ignore_errors: true - From a3700d5f4eafe34cce6c78ca5d0077a2dc7e8e02 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Wed, 21 Aug 2024 11:51:21 +0100 Subject: [PATCH 7/8] x --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 1e013228..f5eeceaf 100644 --- a/tox.ini +++ b/tox.ini @@ -130,7 +130,7 @@ deps = ansible-core -r docs/requirements.txt commands_pre = - ansible-galaxy collection install . + ansible-galaxy collection install --force . commands = antsibull-docs sphinx-init --project="Event Driven Ansible Collection" --title="Event Driven Ansible Collection" --html-short-title="ansible.eda" --fail-on-error --use-current --squash-hierarchy --dest-dir=docs ansible.eda bash ./docs/build.sh From a0a685f3039540a6a29359ac576d252473a6ef26 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Wed, 21 Aug 2024 11:52:42 +0100 Subject: [PATCH 8/8] Fix docs --- docs/rst/credential_module.rst | 9 +++--- docs/rst/decision_environment_module.rst | 40 ++++++++++++++++++++++++ docs/rst/project_module.rst | 40 ++++++++++++++++++++++++ tox.ini | 1 + 4 files changed, 86 insertions(+), 4 deletions(-) diff --git a/docs/rst/credential_module.rst b/docs/rst/credential_module.rst index 68e9f472..7648dd28 100644 --- a/docs/rst/credential_module.rst +++ b/docs/rst/credential_module.rst @@ -370,9 +370,9 @@ Parameters
-
+
- .. _ansible_collections.ansible.eda.credential_module__parameter-org_name: + .. _ansible_collections.ansible.eda.credential_module__parameter-organization: .. _ansible_collections.ansible.eda.credential_module__parameter-organization_name: .. rst-class:: ansible-option-title @@ -385,9 +385,9 @@ Parameters .. ansible-option-type-line:: - :ansible-option-aliases:`aliases: org_name` + :ansible-option-aliases:`aliases: organization` - :ansible-option-type:`integer` + :ansible-option-type:`string` .. raw:: html @@ -565,6 +565,7 @@ Examples inputs: field1: "field1" credential_type_name: "GitLab Personal Access Token" + organization_name: Default - name: Delete an EDA Credential ansible.eda.credential: diff --git a/docs/rst/decision_environment_module.rst b/docs/rst/decision_environment_module.rst index d30cc447..4ab8ea81 100644 --- a/docs/rst/decision_environment_module.rst +++ b/docs/rst/decision_environment_module.rst @@ -362,6 +362,44 @@ Parameters Setting this option will change the existing name. + .. raw:: html + +
+ + * - .. raw:: html + +
+
+
+ + .. _ansible_collections.ansible.eda.decision_environment_module__parameter-organization: + .. _ansible_collections.ansible.eda.decision_environment_module__parameter-organization_name: + + .. rst-class:: ansible-option-title + + **organization_name** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-aliases:`aliases: organization` + + :ansible-option-type:`string` + + .. raw:: html + +
+ + - .. raw:: html + +
+ + The name of the organization. + + .. raw:: html
@@ -529,6 +567,7 @@ Examples description: "Example Decision Environment description" image_url: "quay.io/test" credential: "Example Credential" + organization_name: Default state: present - name: Update the name of the Decision Environment @@ -538,6 +577,7 @@ Examples controller_password: MySuperSecretPassw0rd name: "Example Decision Environment" new_name: "Latest Example Decision Environment" + organization_name: Default state: present - name: Delete the the Decision Environment diff --git a/docs/rst/project_module.rst b/docs/rst/project_module.rst index 9c2ec27d..9d264a3c 100644 --- a/docs/rst/project_module.rst +++ b/docs/rst/project_module.rst @@ -328,6 +328,44 @@ Parameters Setting this option will change the existing name. + .. raw:: html + + + + * - .. raw:: html + +
+
+
+ + .. _ansible_collections.ansible.eda.project_module__parameter-organization: + .. _ansible_collections.ansible.eda.project_module__parameter-organization_name: + + .. rst-class:: ansible-option-title + + **organization_name** + + .. raw:: html + + + + .. ansible-option-type-line:: + + :ansible-option-aliases:`aliases: organization` + + :ansible-option-type:`string` + + .. raw:: html + +
+ + - .. raw:: html + +
+ + The name of the organization. + + .. raw:: html
@@ -528,6 +566,7 @@ Examples name: "Example Project" description: "Example project description" url: "https://example.com/project1" + organization_name: Default state: present - name: Update the name of the project @@ -539,6 +578,7 @@ Examples new_name: "Latest Example Project" description: "Example project description" url: "https://example.com/project1" + organization_name: Default state: present - name: Delete the project diff --git a/tox.ini b/tox.ini index f5eeceaf..e8dab02f 100644 --- a/tox.ini +++ b/tox.ini @@ -130,6 +130,7 @@ deps = ansible-core -r docs/requirements.txt commands_pre = + # --force must remain here or we risk on building docs for older version ansible-galaxy collection install --force . commands = antsibull-docs sphinx-init --project="Event Driven Ansible Collection" --title="Event Driven Ansible Collection" --html-short-title="ansible.eda" --fail-on-error --use-current --squash-hierarchy --dest-dir=docs ansible.eda