From e39efdd6b564feb8cbf0cbb6ff57cc9a34665d7e Mon Sep 17 00:00:00 2001 From: Andrew Twydell Date: Thu, 16 Mar 2023 13:26:58 +0000 Subject: [PATCH 01/14] parameterised integration test, tidy sanity & lint Signed-off-by: Andrew Twydell --- .ansible-lint | 5 + .github/workflows/codeql-analysis.yml | 68 ++---- .gitignore | 3 +- dev-requirements.txt | 10 +- galaxy.yml | 6 +- .../cics_cmci/playbooks/cics_cmci_http.yml | 79 +++++- .../cics_cmci/playbooks/cics_cmci_https.yml | 83 +++++-- .../playbooks/cics_cmci_module_defaults.yml | 224 ++++++++++++------ .../cics_cmci/playbooks/cmci_bas_install.yml | 24 +- .../playbooks/cmci_bas_install_error.yml | 26 +- .../cics_cmci/playbooks/cmci_bas_link.yml | 24 +- .../cmci_create_pipeline_failure.yml | 4 +- .../playbooks/cmci_incorrect_context.yml | 4 +- .../playbooks/cmci_incorrect_host.yml | 4 +- .../playbooks/cmci_incorrect_port.yml | 4 +- .../playbooks/cmci_incorrect_scheme.yml | 4 +- .../playbooks/cmci_incorrect_scope.yml | 2 - .../playbooks/cmci_insecure_false.yml | 4 +- .../playbooks/cmci_install_bundle_failure.yml | 20 +- .../playbooks/cmci_invalid_credentials.yml | 4 +- .../playbooks/cmci_missing_requests.yml | 2 - .../playbooks/cmci_missing_xmltodict.yml | 2 - tests/sanity/ignore-2.11.txt | 1 - tests/sanity/ignore-2.12.txt | 3 +- tests/sanity/ignore-2.14.txt | 2 +- tests/sanity/ignore-2.15.txt | 13 + tests/unit/helpers/cmci_helper.py | 23 +- tests/unit/modules/test_cmci_filters.py | 18 +- 28 files changed, 416 insertions(+), 250 deletions(-) create mode 100644 tests/sanity/ignore-2.15.txt diff --git a/.ansible-lint b/.ansible-lint index 1ecc7014..c476b360 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,3 +1,8 @@ --- skip_list: - "name[template]" + - "args[module]" + - "yaml[line-length]" + - "galaxy[no-changelog]" + - "meta-unsupported-ansible" + - "meta-runtime[unsupported-version]" diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 8cb08dfe..b5bc8dc8 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,68 +1,28 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" +name: CodeQL on: push: - branches: [ main ] + branches: [main] pull_request: - # The branches below must be a subset of the branches above - branches: [ main ] + branches: [main] schedule: - - cron: '41 8 * * 1' + - cron: "0 2 * * 1" + workflow_dispatch: jobs: analyze: name: Analyze runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - language: [ 'python' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - queries: security-extended - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 - - # ℹ️ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language + - name: Checkout repository + uses: actions/checkout@v2 - #- run: | - # make bootstrap - # make release + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: "python" + queries: security-extended - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.gitignore b/.gitignore index 424d9547..5b5739a0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,8 +2,7 @@ docs/build/ .idea __pycache__ -venv2 -venv3 +venv* tests/output ibm-ibm_zos_cics-*.tar.gz tests/integration/targets/cics_cmci/cmci-variables.yml diff --git a/dev-requirements.txt b/dev-requirements.txt index 6d971c8f..4e6c8553 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,8 +1,8 @@ # (c) Copyright IBM Corp. 2020,2021 # Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) -r requirements.txt -ansible-core==2.13.7; python_version >= '3' -ansible-core==2.11.12; python_version < '3' +# ansible-core==2.13.7; python_version >= '3' +# ansible-core==2.11.12; python_version < '3' junit-xml==1.9 # To get JUnit xml report from ansible-test pytest_mock==1.12.1 mock==3.0.5 @@ -17,7 +17,9 @@ rstcheck==3.3.1; python_version >= '3' yamllint==1.29.0; python_version >= '3' voluptuous==0.13.1; python_version >= '3' ansible-doc-extractor==0.1.6; python_version >= '3' -ansible-lint==6.10.2; python_version >= '3' -pycodestyle==2.6.0; python_version >= '3' +# needed to lint devel ansible version +ansible-lint==6.12.2; python_version >= '3' and python_version < '3.9' +ansible-lint==6.13.1; python_version >= '3.9' +pycodestyle==2.10.0; python_version >= '3' Sphinx==3.4.3; python_version >= '3' sphinx-rtd-theme==0.5.1; python_version >= '3' \ No newline at end of file diff --git a/galaxy.yml b/galaxy.yml index 7ed6d531..60b5a4f4 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -27,7 +27,7 @@ description: # License license: [Apache-2.0] # Tags -tags: [ibm, z, zos, z_os, cics, cmci] +tags: [ibm, z, zos, z_os, cics, cmci, infrastructure] # Collections that this collection requires to be installed for it to be usable. # dependencies: {} # This collection depends on no other collections @@ -60,3 +60,7 @@ build_ignore: - requirements.txt - dev-requirements.txt - devguide.md + - .travis + - .github + - .ansible-lint + - .travis.yml diff --git a/tests/integration/targets/cics_cmci/playbooks/cics_cmci_http.yml b/tests/integration/targets/cics_cmci/playbooks/cics_cmci_http.yml index cf305315..18f25e28 100644 --- a/tests/integration/targets/cics_cmci/playbooks/cics_cmci_http.yml +++ b/tests/integration/targets/cics_cmci/playbooks/cics_cmci_http.yml @@ -2,15 +2,13 @@ # Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) --- - name: CMCI HTTP Integration Test - collections: - - ibm.ibm_zos_cics hosts: localhost gather_facts: false vars: - csdgroup: HTTPTEST - program: HTTPTEST - program_2: HTTPTES2 - program_filter: HTTPTES* + csdgroup: "{{ cmci_program_name_1 }}" + program: "{{ cmci_program_name_1 }}" + program_2: "{{ cmci_program_name_2 }}" + program_filter: "{{ cmci_program_filter }}" module_defaults: ibm.ibm_zos_cics.cmci_get: @@ -19,7 +17,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_http }}" + scope: "{{ cmci_scope }}" insecure: true scheme: http @@ -29,7 +27,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_http }}" + scope: "{{ cmci_scope }}" insecure: true scheme: http @@ -39,7 +37,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_http }}" + scope: "{{ cmci_scope }}" insecure: true scheme: http @@ -49,7 +47,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_http }}" + scope: "{{ cmci_scope }}" insecure: true scheme: http @@ -59,11 +57,49 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_http }}" + scope: "{{ cmci_scope }}" insecure: true scheme: http tasks: + ################################################################################## + # Initial cleanup + ################################################################################## + - name: HTTP Disable program + delegate_to: localhost + ibm.ibm_zos_cics.cmci_update: + type: CICSProgram + attributes: + status: disabled + resources: + filter: + PROGRAM: "{{ program }}" + complex_filter: + and: + - attribute: PROGRAM + operator: "=" + value: "{{ program }}" + - or: + - attribute: USECOUNT + operator: "!=" + value: "0" + - attribute: USECOUNT + operator: LT + value: "1" + register: result + failed_when: > + 'cpsm_response' not in result or result.cpsm_response not in ['OK', 'NODATA'] + + - name: HTTP Delete Program + ansible.builtin.include_role: + name: cmci_delete_if_exists + vars: + resource_type: "CICSProgram" + context: "{{ cmci_context }}" + scope: "{{ cmci_scope }}" + attributes: + PROGRAM: "{{ program }}" + - name: HTTP Delete progdef delegate_to: localhost ibm.ibm_zos_cics.cmci_delete: @@ -82,6 +118,27 @@ failed_when: > 'cpsm_response' not in result or result.cpsm_response not in ['OK', 'NODATA'] + - name: HTTP Delete progdef2 + delegate_to: localhost + ibm.ibm_zos_cics.cmci_delete: + type: CICSDefinitionProgram + resources: + complex_filter: + and: + - attribute: NAME + value: "{{ program_2 }}" + - attribute: CSDGROUP + value: "{{ csdgroup }}" + get_parameters: + - name: CSDGROUP + value: "{{ csdgroup }}" + register: result + failed_when: > + 'cpsm_response' not in result or result.cpsm_response not in ['OK', 'NODATA'] + + ################################################################################## + # Main Test + ################################################################################## - name: HTTP Create progdef delegate_to: localhost ibm.ibm_zos_cics.cmci_create: diff --git a/tests/integration/targets/cics_cmci/playbooks/cics_cmci_https.yml b/tests/integration/targets/cics_cmci/playbooks/cics_cmci_https.yml index cbaa6ab5..a0dbac02 100644 --- a/tests/integration/targets/cics_cmci/playbooks/cics_cmci_https.yml +++ b/tests/integration/targets/cics_cmci/playbooks/cics_cmci_https.yml @@ -2,15 +2,13 @@ # Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) --- - name: CMCI HTTPS Integration Test - collections: - - ibm.ibm_zos_cics hosts: localhost gather_facts: false vars: - csdgroup: ANSITEST - program: ANSITEST - program_2: ANSITES2 - program_filter: ANSITES* + csdgroup: "{{ cmci_program_name_1 }}" + program: "{{ cmci_program_name_1 }}" + program_2: "{{ cmci_program_name_2 }}" + program_filter: "{{ cmci_program_filter }}" module_defaults: ibm.ibm_zos_cics.cmci_get: @@ -19,7 +17,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" insecure: true ibm.ibm_zos_cics.cmci_update: @@ -28,7 +26,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" insecure: true ibm.ibm_zos_cics.cmci_delete: @@ -37,7 +35,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" insecure: true ibm.ibm_zos_cics.cmci_action: @@ -46,7 +44,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" insecure: true ibm.ibm_zos_cics.cmci_create: @@ -55,21 +53,69 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" insecure: true tasks: - - name: Delete progdef + ################################################################################## + # Initial cleanup + ################################################################################## + - name: Disable program delegate_to: localhost - ibm.ibm_zos_cics.cmci_delete: - type: CICSDefinitionProgram + ibm.ibm_zos_cics.cmci_update: + type: CICSProgram + attributes: + status: disabled resources: + filter: + PROGRAM: "{{ program }}" complex_filter: and: - - attribute: NAME + - attribute: PROGRAM + operator: "=" value: "{{ program }}" - - attribute: CSDGROUP - value: "{{ csdgroup }}" + - or: + - attribute: USECOUNT + operator: "!=" + value: "0" + - attribute: USECOUNT + operator: LT + value: "1" + register: result + failed_when: > + 'cpsm_response' not in result or result.cpsm_response not in ['OK', 'NODATA'] + + - name: Delete Program + ansible.builtin.include_role: + name: cmci_delete_if_exists + vars: + resource_type: "CICSProgram" + context: "{{ cmci_context }}" + scope: "{{ cmci_scope }}" + attributes: + PROGRAM: "{{ program }}" + + - name: Delete progdef + delegate_to: localhost + ibm.ibm_zos_cics.cmci_delete: + type: CICSDefinitionProgram + resources: + filter: + NAME: "{{ program }}" + get_parameters: + - name: CSDGROUP + value: "{{ csdgroup }}" + register: result + failed_when: > + 'cpsm_response' not in result or result.cpsm_response not in ['OK', 'NODATA'] + + - name: Delete progdef 2 + delegate_to: localhost + ibm.ibm_zos_cics.cmci_delete: + type: CICSDefinitionProgram + resources: + filter: + NAME: "{{ program_2 }}" get_parameters: - name: CSDGROUP value: "{{ csdgroup }}" @@ -77,6 +123,9 @@ failed_when: > 'cpsm_response' not in result or result.cpsm_response not in ['OK', 'NODATA'] + ################################################################################## + # Main Test + ################################################################################## - name: Create progdef delegate_to: localhost ibm.ibm_zos_cics.cmci_create: diff --git a/tests/integration/targets/cics_cmci/playbooks/cics_cmci_module_defaults.yml b/tests/integration/targets/cics_cmci/playbooks/cics_cmci_module_defaults.yml index 93629599..8318f291 100644 --- a/tests/integration/targets/cics_cmci/playbooks/cics_cmci_module_defaults.yml +++ b/tests/integration/targets/cics_cmci/playbooks/cics_cmci_module_defaults.yml @@ -2,18 +2,16 @@ # Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) --- - name: CMCI Group Module_Default Integration Tests - collections: - - ibm.ibm_zos_cics hosts: localhost gather_facts: false vars: - csdgroup: HTTPTEST - program: HTTPTEST - program_2: HTTPTES2 - program_filter: HTTPTES* + csdgroup: "{{ cmci_program_name_1 }}" + program: "{{ cmci_program_name_1 }}" + program_2: "{{ cmci_program_name_2 }}" + program_filter: "{{ cmci_program_filter }}" error_msg_27: "missing required arguments: cmci_host, cmci_port, context" error_msg_38: CMCI request failed with response "NODATA" reason "1027" - error_msg: "{{ error_msg_27 if lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '2.7' else error_msg_38 }}" + error_msg: "{{ error_msg_27 if ansible_version.minor <= 11 else error_msg_38 }}" module_defaults: group/ibm.ibm_zos_cics.cmci_group: @@ -22,35 +20,115 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_http }}" + scope: "{{ cmci_scope }}" insecure: true scheme: http tasks: - - name: HTTP Delete progdef + ################################################################################## + # Initial cleanup + ################################################################################## + - name: HTTP Disable program delegate_to: localhost - cmci_delete: - type: CICSDefinitionProgram + cmci_update: + type: CICSProgram + cmci_host: "{{ cmci_host }}" + cmci_port: "{{ cmci_port }}" + cmci_user: "{{ cmci_user }}" + cmci_password: "{{ cmci_password }}" + context: "{{ cmci_context }}" + scope: "{{ cmci_scope }}" + insecure: true + scheme: http + attributes: + status: disabled resources: + filter: + PROGRAM: "{{ program }}" complex_filter: and: - - attribute: NAME + - attribute: PROGRAM + operator: "=" value: "{{ program }}" - - attribute: CSDGROUP - value: "{{ csdgroup }}" + - or: + - attribute: USECOUNT + operator: "!=" + value: "0" + - attribute: USECOUNT + operator: LT + value: "1" + register: result + failed_when: > + 'cpsm_response' not in result or result.cpsm_response not in ['OK', 'NODATA'] + + + - name: HTTP Delete program + delegate_to: localhost + cmci_delete: + type: CICSProgram + cmci_host: "{{ cmci_host }}" + cmci_port: "{{ cmci_port }}" + cmci_user: "{{ cmci_user }}" + cmci_password: "{{ cmci_password }}" + context: "{{ cmci_context }}" + scope: "{{ cmci_scope }}" + insecure: true + scheme: http + resources: + filter: + PROGRAM: "{{ program }}" + register: result + failed_when: > + 'cpsm_response' not in result or result.cpsm_response not in ['OK', 'NODATA'] + + + - name: Delete progdef + delegate_to: localhost + ibm.ibm_zos_cics.cmci_delete: + type: CICSDefinitionProgram + cmci_host: "{{ cmci_host }}" + cmci_port: "{{ cmci_port }}" + cmci_user: "{{ cmci_user }}" + cmci_password: "{{ cmci_password }}" + context: "{{ cmci_context }}" + scope: "{{ cmci_scope }}" + insecure: true + scheme: http + resources: + filter: + NAME: "{{ program }}" get_parameters: - name: CSDGROUP value: "{{ csdgroup }}" register: result - failed_when: false + failed_when: > + 'cpsm_response' not in result or result.cpsm_response not in ['OK', 'NODATA'] - - name: Assert - ansible.builtin.assert: - that: - - result.changed == false - - result.failed_when_result == false - - result.msg == error_msg + - name: Delete progdef 2 + delegate_to: localhost + ibm.ibm_zos_cics.cmci_delete: + type: CICSDefinitionProgram + cmci_host: "{{ cmci_host }}" + cmci_port: "{{ cmci_port }}" + cmci_user: "{{ cmci_user }}" + cmci_password: "{{ cmci_password }}" + context: "{{ cmci_context }}" + scope: "{{ cmci_scope }}" + insecure: true + scheme: http + resources: + filter: + NAME: "{{ program_2 }}" + get_parameters: + - name: CSDGROUP + value: "{{ csdgroup }}" + register: result + failed_when: > + 'cpsm_response' not in result or result.cpsm_response not in ['OK', 'NODATA'] + ################################################################################## + # Main Test + ################################################################################## - name: HTTP Create progdef delegate_to: localhost cmci_create: @@ -63,8 +141,8 @@ register: result failed_when: false - - name: Assert 1 38 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '3.8' + - name: Assert 1 2.12 + when: ansible_version.minor >= 12 ansible.builtin.assert: that: - result is changed @@ -72,8 +150,8 @@ - result.record_count == 1 - result.records[0].name == program - - name: Assert 1 27 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '2.7' + - name: Assert 1 2.11 + when: ansible_version.minor <= 11 ansible.builtin.assert: that: - result.changed == false @@ -95,8 +173,8 @@ register: result failed_when: false - - name: Assert 2 38 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '3.8' + - name: Assert 2 2.12 + when: ansible_version.minor >= 12 ansible.builtin.assert: that: - result is changed @@ -104,8 +182,8 @@ - result.record_count == 1 - result.records[0].description == 'foo' - - name: Assert 2 27 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '2.7' + - name: Assert 2 2.11 + when: ansible_version.minor <= 11 ansible.builtin.assert: that: - result.changed == false @@ -126,16 +204,16 @@ register: result failed_when: false - - name: Assert 3 38 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '3.8' + - name: Assert 3 2.12 + when: ansible_version.minor >= 12 ansible.builtin.assert: that: - result is changed - result.cpsm_response == 'OK' - result.record_count == 1 - - name: Assert 3 27 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '2.7' + - name: Assert 3 2.11 + when: ansible_version.minor <= 11 ansible.builtin.assert: that: - result.changed == false @@ -154,8 +232,8 @@ register: result failed_when: false - - name: Assert 4 38 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '3.8' + - name: Assert 4 2.12 + when: ansible_version.minor >= 12 ansible.builtin.assert: that: - result is not changed @@ -163,8 +241,8 @@ - result.record_count == 1 - result.records[0].program == program - - name: Assert 4 27 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '2.7' + - name: Assert 4 2.11 + when: ansible_version.minor <= 11 ansible.builtin.assert: that: - result.changed == false @@ -195,8 +273,8 @@ register: result failed_when: false - - name: Assert 5 38 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '3.8' + - name: Assert 5 2.12 + when: ansible_version.minor >= 12 ansible.builtin.assert: that: - result is changed @@ -205,8 +283,8 @@ - result.records[0].program == program - result.records[0].status == 'DISABLED' - - name: Assert 5 27 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '2.7' + - name: Assert 5 2.11 + when: ansible_version.minor <= 11 ansible.builtin.assert: that: - result.changed == false @@ -223,8 +301,8 @@ register: result failed_when: false - - name: Assert 6 38 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '3.8' + - name: Assert 6 2.12 + when: ansible_version.minor >= 12 ansible.builtin.assert: that: - result is changed @@ -232,8 +310,8 @@ - result.record_count == 1 - result.success_count == 1 - - name: Assert 6 27 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '2.7' + - name: Assert 6 2.11 + when: ansible_version.minor <= 11 ansible.builtin.assert: that: - result.changed == false @@ -252,8 +330,8 @@ register: result failed_when: false - - name: Assert program_2 created 38 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '3.8' + - name: Assert program_2 created 2.12 + when: ansible_version.minor >= 12 ansible.builtin.assert: that: - result is changed @@ -261,8 +339,8 @@ - result.record_count == 1 - result.records[0].name == program_2 - - name: Assert program_2 created 27 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '2.7' + - name: Assert program_2 created 2.11 + when: ansible_version.minor <= 11 ansible.builtin.assert: that: - result.changed == false @@ -282,16 +360,16 @@ register: result failed_when: false - - name: Assert record_count is 2 38 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '3.8' + - name: Assert record_count is 2 2.12 + when: ansible_version.minor >= 12 ansible.builtin.assert: that: - result is not changed - result.cpsm_response == 'OK' - result.record_count == 2 - - name: Assert record_count is 2 27 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '2.7' + - name: Assert record_count is 2 2.11 + when: ansible_version.minor <= 11 ansible.builtin.assert: that: - result.changed == false @@ -312,8 +390,8 @@ register: result failed_when: false - - name: Assert record_count attribute 38 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '3.8' + - name: Assert record_count attribute 2.12 + when: ansible_version.minor >= 12 ansible.builtin.assert: that: - result is not changed @@ -321,8 +399,8 @@ - result.record_count == 2 - result.records|length == 1 - - name: Assert record_count attribute 27 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '2.7' + - name: Assert record_count attribute 2.11 + when: ansible_version.minor <= 11 ansible.builtin.assert: that: - result.changed == false @@ -342,8 +420,8 @@ register: result failed_when: false - - name: Assert 7 38 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '3.8' + - name: Assert 7 2.12 + when: ansible_version.minor >= 12 ansible.builtin.assert: that: - result is changed @@ -351,8 +429,8 @@ - result.record_count == 1 - result.success_count == 1 - - name: Assert 7 27 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '2.7' + - name: Assert 7 2.11 + when: ansible_version.minor <= 11 ansible.builtin.assert: that: - result.changed == false @@ -372,8 +450,8 @@ register: result failed_when: false - - name: Assert program_2 deleted 38 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '3.8' + - name: Assert program_2 deleted 2.12 + when: ansible_version.minor >= 12 ansible.builtin.assert: that: - result is changed @@ -381,8 +459,8 @@ - result.record_count == 1 - result.success_count == 1 - - name: Assert program_2 deleted 27 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '2.7' + - name: Assert program_2 deleted 2.11 + when: ansible_version.minor <= 11 ansible.builtin.assert: that: - result.changed == false @@ -402,8 +480,8 @@ register: result failed_when: false - - name: Assert fail_on_nodata attribute default 38 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '3.8' + - name: Assert fail_on_nodata attribute default 2.12 + when: ansible_version.minor >= 12 ansible.builtin.assert: that: - result is not changed @@ -414,8 +492,8 @@ - result.msg is defined - result.failed_when_result is defined - - name: Assert fail_on_nodata attribute default 27 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '2.7' + - name: Assert fail_on_nodata attribute default 2.11 + when: ansible_version.minor <= 11 ansible.builtin.assert: that: - result.changed == false @@ -436,8 +514,8 @@ register: result failed_when: false - - name: Assert fail_on_nodata attribute false 38 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '3.8' + - name: Assert fail_on_nodata attribute false 2.12 + when: ansible_version.minor >= 12 ansible.builtin.assert: that: - result is not changed @@ -448,8 +526,8 @@ - result.msg is not defined - result.failed_when_result == false - - name: Assert fail_on_nodata attribute false 27 - when: lookup('env', 'ANSIBLE_TEST_PYTHON_VERSION') == '2.7' + - name: Assert fail_on_nodata attribute false 2.11 + when: ansible_version.minor <= 11 ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/cics_cmci/playbooks/cmci_bas_install.yml b/tests/integration/targets/cics_cmci/playbooks/cmci_bas_install.yml index e63bead3..2c14b708 100644 --- a/tests/integration/targets/cics_cmci/playbooks/cmci_bas_install.yml +++ b/tests/integration/targets/cics_cmci/playbooks/cmci_bas_install.yml @@ -5,19 +5,17 @@ # Sets Up a full BAS resource assignment deployment. Checks to see where programs will be installed and then # installs to two regions with a target scope and one related scope. Uninstalls and deletes everything created after - collections: - - ibm.ibm_zos_cics hosts: localhost gather_facts: false vars: - program: ANSIPROG - resource_description: ANSIDESC - resource_assignment: ANSIGMNT - resource_group: ANSIRGRP - related_scope: "{{ cmci_scope_http }}" + program: "{{ cmci_program_name_1 }}" + resource_description: "{{ cmci_program_name_2 }}" + resource_assignment: "{{ cmci_program_name_2 }}" + resource_group: "{{ cmci_program_name_1 }}" + related_scope: "{{ cmci_scope }}" region_one: "{{ cmci_scope_region_1 }}" region_two: "{{ cmci_scope_region_2 }}" - target_scope: ANSITARG + target_scope: "{{ cmci_program_name_1 }}" def_ver: "1" module_defaults: @@ -27,7 +25,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" insecure: true ibm.ibm_zos_cics.cmci_update: @@ -36,7 +34,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" insecure: true ibm.ibm_zos_cics.cmci_delete: @@ -45,7 +43,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" insecure: true ibm.ibm_zos_cics.cmci_action: @@ -54,7 +52,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" insecure: true ibm.ibm_zos_cics.cmci_create: @@ -63,7 +61,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" insecure: true tasks: diff --git a/tests/integration/targets/cics_cmci/playbooks/cmci_bas_install_error.yml b/tests/integration/targets/cics_cmci/playbooks/cmci_bas_install_error.yml index 6b78c718..fce13205 100644 --- a/tests/integration/targets/cics_cmci/playbooks/cmci_bas_install_error.yml +++ b/tests/integration/targets/cics_cmci/playbooks/cmci_bas_install_error.yml @@ -6,20 +6,18 @@ # installs to two regions with a target scope and one related scope. Then attempts to install again and checks an error # occured with feedback and nested installerrors. Uninstalls and deletes everything created after - collections: - - ibm.ibm_zos_cics hosts: localhost gather_facts: false vars: - res_def: ANSIFIL* - file1: ANSIFIL1 - file2: ANSIFIL2 - resource_description: ANSIDESC - resource_assignment: ANSIGMNT + file1: "{{ cmci_program_name_1 }}" + file2: "{{ cmci_program_name_2 }}" + res_def: "{{ cmci_program_filter }}" + resource_description: "{{ cmci_program_name_2 }}" + resource_assignment: "{{ cmci_program_name_2 }}" resource_assignment_type_target: CICSRemoteFile resource_assignment_type_related: CICSLocalFile - resource_group: ANSIRGRP - related_scope: "{{ cmci_scope_http }}" + resource_group: "{{ cmci_program_name_1 }}" + related_scope: "{{ cmci_scope }}" target_scope: "{{ cmci_scope_region_1 }}" def_ver: "1" @@ -30,7 +28,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" insecure: true ibm.ibm_zos_cics.cmci_update: @@ -39,7 +37,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" insecure: true ibm.ibm_zos_cics.cmci_delete: @@ -48,7 +46,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" insecure: true ibm.ibm_zos_cics.cmci_action: @@ -57,7 +55,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" insecure: true ibm.ibm_zos_cics.cmci_create: @@ -66,7 +64,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" insecure: true tasks: diff --git a/tests/integration/targets/cics_cmci/playbooks/cmci_bas_link.yml b/tests/integration/targets/cics_cmci/playbooks/cmci_bas_link.yml index 3bf0d05c..df26d194 100644 --- a/tests/integration/targets/cics_cmci/playbooks/cmci_bas_link.yml +++ b/tests/integration/targets/cics_cmci/playbooks/cmci_bas_link.yml @@ -4,14 +4,12 @@ - name: CMCI BAS Link Integration Test # Sets Up a Basic BAS Resource Description with one Resource Group containing one program definition and then cleans up - collections: - - ibm.ibm_zos_cics hosts: localhost gather_facts: false vars: - program: ANSIPROG - resource_description: ANSIBAS - resource_group: ANSIGRP + program: "{{ cmci_program_name_1 }}" + resource_description: "{{ cmci_program_name_2 }}" + resource_group: "{{ cmci_program_name_2 }}" resource_scope: "{{ cmci_scope_region_2 }}" def_ver: "1" @@ -22,7 +20,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" insecure: true ibm.ibm_zos_cics.cmci_update: @@ -31,7 +29,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" insecure: true ibm.ibm_zos_cics.cmci_delete: @@ -40,7 +38,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" insecure: true ibm.ibm_zos_cics.cmci_action: @@ -49,7 +47,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" insecure: true ibm.ibm_zos_cics.cmci_create: @@ -58,10 +56,13 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" insecure: true tasks: + ################################################################################## + # Initial cleanup + ################################################################################## - name: Delete progdef delegate_to: localhost ibm.ibm_zos_cics.cmci_delete: @@ -99,6 +100,9 @@ failed_when: > 'cpsm_response' not in result or result.cpsm_response not in ['OK', 'NODATA'] + ################################################################################## + # Main Test + ################################################################################## - name: Create progdef delegate_to: localhost ibm.ibm_zos_cics.cmci_create: diff --git a/tests/integration/targets/cics_cmci/playbooks/cmci_create_pipeline_failure.yml b/tests/integration/targets/cics_cmci/playbooks/cmci_create_pipeline_failure.yml index d3b1db6b..2e27d4cd 100644 --- a/tests/integration/targets/cics_cmci/playbooks/cmci_create_pipeline_failure.yml +++ b/tests/integration/targets/cics_cmci/playbooks/cmci_create_pipeline_failure.yml @@ -2,8 +2,6 @@ # Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) --- - name: CMCI Create Pipeline Failure Integration Test - collections: - - ibm.ibm_zos_cics hosts: localhost gather_facts: false @@ -16,7 +14,7 @@ cmci_password: "{{ cmci_password }}" insecure: true context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" type: CICSDefinitionPipeline create_parameters: - name: CSD diff --git a/tests/integration/targets/cics_cmci/playbooks/cmci_incorrect_context.yml b/tests/integration/targets/cics_cmci/playbooks/cmci_incorrect_context.yml index 23b74f73..09d3d569 100644 --- a/tests/integration/targets/cics_cmci/playbooks/cmci_incorrect_context.yml +++ b/tests/integration/targets/cics_cmci/playbooks/cmci_incorrect_context.yml @@ -2,8 +2,6 @@ # Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) --- - name: CMCI Incorrect Context Integration Test - collections: - - ibm.ibm_zos_cics hosts: localhost gather_facts: false @@ -16,7 +14,7 @@ cmci_password: "{{ cmci_password }}" insecure: true context: invalid - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" type: cicsprogram failed_when: false register: result diff --git a/tests/integration/targets/cics_cmci/playbooks/cmci_incorrect_host.yml b/tests/integration/targets/cics_cmci/playbooks/cmci_incorrect_host.yml index a446f347..d6571e51 100644 --- a/tests/integration/targets/cics_cmci/playbooks/cmci_incorrect_host.yml +++ b/tests/integration/targets/cics_cmci/playbooks/cmci_incorrect_host.yml @@ -2,8 +2,6 @@ # Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) --- - name: CMCI Incorrect Host Integration Test - collections: - - ibm.ibm_zos_cics hosts: localhost gather_facts: true @@ -16,7 +14,7 @@ cmci_password: "{{ cmci_password }}" insecure: true context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" type: cicsprogram failed_when: false register: result diff --git a/tests/integration/targets/cics_cmci/playbooks/cmci_incorrect_port.yml b/tests/integration/targets/cics_cmci/playbooks/cmci_incorrect_port.yml index b4d82fea..22cf4522 100644 --- a/tests/integration/targets/cics_cmci/playbooks/cmci_incorrect_port.yml +++ b/tests/integration/targets/cics_cmci/playbooks/cmci_incorrect_port.yml @@ -2,8 +2,6 @@ # Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) --- - name: CMCI Incorrect Port Integration Test - collections: - - ibm.ibm_zos_cics hosts: localhost gather_facts: false @@ -15,7 +13,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" type: cicsprogram failed_when: false register: result diff --git a/tests/integration/targets/cics_cmci/playbooks/cmci_incorrect_scheme.yml b/tests/integration/targets/cics_cmci/playbooks/cmci_incorrect_scheme.yml index 8d7d1793..deb24b77 100644 --- a/tests/integration/targets/cics_cmci/playbooks/cmci_incorrect_scheme.yml +++ b/tests/integration/targets/cics_cmci/playbooks/cmci_incorrect_scheme.yml @@ -2,8 +2,6 @@ # Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) --- - name: CMCI Incorrect Scope Integration Test - collections: - - ibm.ibm_zos_cics hosts: localhost gather_facts: true vars: @@ -25,7 +23,7 @@ cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" type: cicsprogram scheme: http insecure: true diff --git a/tests/integration/targets/cics_cmci/playbooks/cmci_incorrect_scope.yml b/tests/integration/targets/cics_cmci/playbooks/cmci_incorrect_scope.yml index ce79373b..5cbdae17 100644 --- a/tests/integration/targets/cics_cmci/playbooks/cmci_incorrect_scope.yml +++ b/tests/integration/targets/cics_cmci/playbooks/cmci_incorrect_scope.yml @@ -2,8 +2,6 @@ # Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) --- - name: CMCI Incorrect Scope Integration Test - collections: - - ibm.ibm_zos_cics hosts: localhost gather_facts: false diff --git a/tests/integration/targets/cics_cmci/playbooks/cmci_insecure_false.yml b/tests/integration/targets/cics_cmci/playbooks/cmci_insecure_false.yml index 74f05403..18530f10 100644 --- a/tests/integration/targets/cics_cmci/playbooks/cmci_insecure_false.yml +++ b/tests/integration/targets/cics_cmci/playbooks/cmci_insecure_false.yml @@ -2,8 +2,6 @@ # Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) --- - name: CMCI Insecure False Integration Test - collections: - - ibm.ibm_zos_cics hosts: localhost gather_facts: false @@ -15,7 +13,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" type: cicsprogram insecure: false resources: diff --git a/tests/integration/targets/cics_cmci/playbooks/cmci_install_bundle_failure.yml b/tests/integration/targets/cics_cmci/playbooks/cmci_install_bundle_failure.yml index f1e2d685..7ecffa37 100644 --- a/tests/integration/targets/cics_cmci/playbooks/cmci_install_bundle_failure.yml +++ b/tests/integration/targets/cics_cmci/playbooks/cmci_install_bundle_failure.yml @@ -2,13 +2,11 @@ # Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) --- - name: CMCI Install Bundle Failure Integration Test - collections: - - ibm.ibm_zos_cics hosts: localhost gather_facts: false vars: - csdgroup: ANSITEST - bunddef: ANSIBUND + csdgroup: "{{ cmci_program_name_1 }}" + bunddef: "{{ cmci_program_name_2 }}" module_defaults: ibm.ibm_zos_cics.cmci_delete: @@ -17,7 +15,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" insecure: true ibm.ibm_zos_cics.cmci_action: @@ -26,7 +24,7 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" insecure: true ibm.ibm_zos_cics.cmci_create: @@ -35,10 +33,13 @@ cmci_user: "{{ cmci_user }}" cmci_password: "{{ cmci_password }}" context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" insecure: true tasks: + ################################################################################## + # Initial cleanup + ################################################################################## - name: Delete bundle def delegate_to: localhost ibm.ibm_zos_cics.cmci_delete: @@ -57,6 +58,9 @@ failed_when: > 'cpsm_response' not in result or result.cpsm_response not in ['OK', 'NODATA'] + ################################################################################## + # Main Test + ################################################################################## - name: Create bundle def delegate_to: localhost ibm.ibm_zos_cics.cmci_create: @@ -106,7 +110,7 @@ - result.feedback[1].action == 'CSDINSTALL' - result.feedback[1].eibfn == 'A20E' - result.feedback[1].eibfn_alt == 'CSD INSTALL' - - result.feedback[1].eyu_cicsname == cmci_scope_https + - result.feedback[1].eyu_cicsname == cmci_scope - result.feedback[1].resp == '16' - result.feedback[1].resp2 == '633' # 'Installation of BUNDLE resource resource failed because the resource had no manifest' - result.feedback[1].resp_alt == 'INVREQ' diff --git a/tests/integration/targets/cics_cmci/playbooks/cmci_invalid_credentials.yml b/tests/integration/targets/cics_cmci/playbooks/cmci_invalid_credentials.yml index 0f5d9ab7..057e3f83 100644 --- a/tests/integration/targets/cics_cmci/playbooks/cmci_invalid_credentials.yml +++ b/tests/integration/targets/cics_cmci/playbooks/cmci_invalid_credentials.yml @@ -2,8 +2,6 @@ # Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) --- - name: CMCI Invalid Credentials Integration Test - collections: - - ibm.ibm_zos_cics hosts: localhost gather_facts: false @@ -19,7 +17,7 @@ cmci_password: "{{ cmci_password }}" insecure: true context: "{{ cmci_context }}" - scope: "{{ cmci_scope_https }}" + scope: "{{ cmci_scope }}" type: cicsprogram failed_when: false register: result diff --git a/tests/integration/targets/cics_cmci_missing_requests_library/playbooks/cmci_missing_requests.yml b/tests/integration/targets/cics_cmci_missing_requests_library/playbooks/cmci_missing_requests.yml index 637af751..93f28403 100644 --- a/tests/integration/targets/cics_cmci_missing_requests_library/playbooks/cmci_missing_requests.yml +++ b/tests/integration/targets/cics_cmci_missing_requests_library/playbooks/cmci_missing_requests.yml @@ -2,8 +2,6 @@ # Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) --- - name: CMCI Missing Requests Integration Test - collections: - - ibm.ibm_zos_cics hosts: localhost gather_facts: false diff --git a/tests/integration/targets/cics_cmci_missing_xmltodict_library/playbooks/cmci_missing_xmltodict.yml b/tests/integration/targets/cics_cmci_missing_xmltodict_library/playbooks/cmci_missing_xmltodict.yml index 568a81a4..a55eb93c 100644 --- a/tests/integration/targets/cics_cmci_missing_xmltodict_library/playbooks/cmci_missing_xmltodict.yml +++ b/tests/integration/targets/cics_cmci_missing_xmltodict_library/playbooks/cmci_missing_xmltodict.yml @@ -2,8 +2,6 @@ # Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) --- - name: CMCI Missing XMLToDict Library Integration Test - collections: - - ibm.ibm_zos_cics hosts: localhost gather_facts: false diff --git a/tests/sanity/ignore-2.11.txt b/tests/sanity/ignore-2.11.txt index cea87474..c12f154d 100644 --- a/tests/sanity/ignore-2.11.txt +++ b/tests/sanity/ignore-2.11.txt @@ -4,7 +4,6 @@ plugins/modules/cmci_action.py validate-modules:missing-gplv3-license # Licence plugins/modules/cmci_create.py validate-modules:missing-gplv3-license # Licence is Apache-2.0 plugins/modules/cmci_delete.py validate-modules:missing-gplv3-license # Licence is Apache-2.0 plugins/modules/cmci_update.py validate-modules:missing-gplv3-license # Licence is Apache-2.0 -plugins/doc_fragments/cmci.py pep8:E501 # Link can't be split or it does not render correctly plugins/module_utils/cmci.py import-2.7 plugins/modules/cmci_action.py import-2.7 plugins/modules/cmci_create.py import-2.7 diff --git a/tests/sanity/ignore-2.12.txt b/tests/sanity/ignore-2.12.txt index 26fa9c20..34e837cb 100644 --- a/tests/sanity/ignore-2.12.txt +++ b/tests/sanity/ignore-2.12.txt @@ -3,5 +3,4 @@ plugins/modules/cmci_get.py validate-modules:missing-gplv3-license # Licence is plugins/modules/cmci_action.py validate-modules:missing-gplv3-license # Licence is Apache-2.0 plugins/modules/cmci_create.py validate-modules:missing-gplv3-license # Licence is Apache-2.0 plugins/modules/cmci_delete.py validate-modules:missing-gplv3-license # Licence is Apache-2.0 -plugins/modules/cmci_update.py validate-modules:missing-gplv3-license # Licence is Apache-2.0 -plugins/doc_fragments/cmci.py pep8:E501 # Link can't be split or it does not render correctly \ No newline at end of file +plugins/modules/cmci_update.py validate-modules:missing-gplv3-license # Licence is Apache-2.0 \ No newline at end of file diff --git a/tests/sanity/ignore-2.14.txt b/tests/sanity/ignore-2.14.txt index c99443a9..9e9989fd 100644 --- a/tests/sanity/ignore-2.14.txt +++ b/tests/sanity/ignore-2.14.txt @@ -4,4 +4,4 @@ plugins/modules/cmci_action.py validate-modules:missing-gplv3-license # Licence plugins/modules/cmci_create.py validate-modules:missing-gplv3-license # Licence is Apache-2.0 plugins/modules/cmci_delete.py validate-modules:missing-gplv3-license # Licence is Apache-2.0 plugins/modules/cmci_update.py validate-modules:missing-gplv3-license # Licence is Apache-2.0 -plugins/doc_fragments/cmci.py pep8:E501 # Link can't be split or it does not render correctly +plugins/module_utils/cmci.py pylint:used-before-assignment diff --git a/tests/sanity/ignore-2.15.txt b/tests/sanity/ignore-2.15.txt new file mode 100644 index 00000000..f7160e91 --- /dev/null +++ b/tests/sanity/ignore-2.15.txt @@ -0,0 +1,13 @@ +docs/make.bat line-endings!skip # Windows batch file requires windows line endings. +plugins/modules/cmci_get.py validate-modules:missing-gplv3-license # Licence is Apache-2.0 +plugins/modules/cmci_action.py validate-modules:missing-gplv3-license # Licence is Apache-2.0 +plugins/modules/cmci_create.py validate-modules:missing-gplv3-license # Licence is Apache-2.0 +plugins/modules/cmci_delete.py validate-modules:missing-gplv3-license # Licence is Apache-2.0 +plugins/modules/cmci_update.py validate-modules:missing-gplv3-license # Licence is Apache-2.0 +plugins/module_utils/cmci.py pylint:used-before-assignment +tests/unit/modules/test_cmci_action.py pylint:unused-import +tests/unit/modules/test_cmci_create.py pylint:unused-import +tests/unit/modules/test_cmci_delete.py pylint:unused-import +tests/unit/modules/test_cmci_filters.py pylint:unused-import +tests/unit/modules/test_cmci_get.py pylint:unused-import +tests/unit/modules/test_cmci_update.py pylint:unused-import \ No newline at end of file diff --git a/tests/unit/helpers/cmci_helper.py b/tests/unit/helpers/cmci_helper.py index 649f08ab..4a93f1ce 100644 --- a/tests/unit/helpers/cmci_helper.py +++ b/tests/unit/helpers/cmci_helper.py @@ -103,11 +103,12 @@ def stub_cmci(self, method, resource_type, scheme='https', host=HOST, port=PORT, def expect(self, expected): self.expected = expected - def expect_list(self, chars_before_list, chars_after_list, string_containing_list='msg'): + def expect_list(self, chars_before_list, chars_after_list, expected_output_options, string_containing_list='msg'): self.expected_list = True self.chars_before_list = chars_before_list self.chars_after_list = chars_after_list self.string_containing_list = string_containing_list + self.expected_output_options = expected_output_options def run(self, module, config): # upper-case the resource name, so it definitely doesn't match the CMCI response, to ensure @@ -133,12 +134,20 @@ def run(self, module, config): concat = before_list + ", ".join(actual_list) + after_list result.update({self.string_containing_list: concat}) - if self.expected != result: - standard_msg = '%s != %s' % (repr(self.expected), repr(result)) - diff = ('\n' + '\n'.join(difflib.ndiff( - pprint.pformat(self.expected).splitlines(), - pprint.pformat(result).splitlines()))) - raise AssertionError(standard_msg + diff) + # Result now contains actual response, but with an ordered list of options + # We use output_options instead of expected as the expected result could be one of multiple + if result not in self.expected_output_options: + self.assert_error(result) + else: + if self.expected != result: + self.assert_error(result) + + def assert_error(self, result): + standard_msg = '%s != %s' % (repr(self.expected), repr(result)) + diff = ('\n' + '\n'.join(difflib.ndiff( + pprint.pformat(self.expected).splitlines(), + pprint.pformat(result).splitlines()))) + raise AssertionError(standard_msg + diff) @pytest.fixture diff --git a/tests/unit/modules/test_cmci_filters.py b/tests/unit/modules/test_cmci_filters.py index f3c5298b..6f32fd60 100644 --- a/tests/unit/modules/test_cmci_filters.py +++ b/tests/unit/modules/test_cmci_filters.py @@ -645,18 +645,26 @@ def test_extra_attributes_root(cmci_module): # list first. This means passing tests if all expected attributes are listed, but not caring about # the order. before_list = "Unsupported parameters for (basic.%s) module: resources.complex_filter.orange. Supported parameters include: " % extension - sorted_list = ["cmci_cert", "cmci_host", "cmci_key", "cmci_password", - "cmci_port", "cmci_user", "context", "fail_on_nodata", "insecure", - "record_count", "resources", "scheme", "scope", "timeout", "type"] + sorted_list_older_ansible = [ + "cmci_cert", "cmci_host", "cmci_key", "cmci_password", + "cmci_port", "cmci_user", "context", "fail_on_nodata", "insecure", + "record_count", "resources", "scheme", "scope", "timeout", "type"] + sorted_list_newer_ansible = ["and", "attribute", "operator", "or", "value"] after_list = "." cmci_module.expect_list( chars_before_list=len(before_list), chars_after_list=len(after_list), - string_containing_list='msg' + string_containing_list='msg', + expected_output_options=[{ + 'msg': before_list + ", ".join(sorted_list_older_ansible) + after_list, + 'failed': True + }, { + 'msg': before_list + ", ".join(sorted_list_newer_ansible) + after_list, + 'failed': True + }] ) cmci_module.expect({ - 'msg': before_list + ", ".join(sorted_list) + after_list, 'failed': True }) From 31a57000d9c68312f61bbf97ef1ffb4abcfacc61 Mon Sep 17 00:00:00 2001 From: Andrew Twydell Date: Thu, 16 Mar 2023 13:32:57 +0000 Subject: [PATCH 02/14] build / test with travis & artifactory Signed-off-by: Andrew Twydell --- .travis.yml | 56 ++++++++++++++++++++++++++++++ .travis/build_and_test.sh | 59 ++++++++++++++++++++++++++++++++ .travis/build_env.sh | 35 +++++++++++++++++++ .travis/get_artifactory_creds.sh | 9 +++++ 4 files changed, 159 insertions(+) create mode 100644 .travis.yml create mode 100755 .travis/build_and_test.sh create mode 100755 .travis/build_env.sh create mode 100755 .travis/get_artifactory_creds.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..4c81c7e4 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,56 @@ +language: python +python: + - "2.7" + - "3.8" + - "3.9" + - "3.10" +env: + - ANSIBLE_VERSION="stable-2.11" + - ANSIBLE_VERSION="stable-2.12" + - ANSIBLE_VERSION="stable-2.13" + - ANSIBLE_VERSION="stable-2.14" + - ANSIBLE_VERSION="devel" +matrix: + exclude: + # Python 2.7 max ansible version is 2.11 + - python: "2.7" + env: ANSIBLE_VERSION="stable-2.12" + - python: "2.7" + env: ANSIBLE_VERSION="stable-2.13" + - python: "2.7" + env: ANSIBLE_VERSION="stable-2.14" + - python: "2.7" + env: ANSIBLE_VERSION="devel" + # Python 3.8 max ansible version is 2.13 + - python: "3.8" + env: ANSIBLE_VERSION="stable-2.14" + - python: "3.8" + env: ANSIBLE_VERSION="devel" + # Ansible 2.11 max python version support is 3.9 + - python: "3.10" + env: ANSIBLE_VERSION="stable-2.11" +services: + - docker +before_script: source .travis/get_artifactory_creds.sh +script: | + echo "" + echo "#############################################" + echo "# PYTHON VERSION: ${TRAVIS_PYTHON_VERSION}" + echo "# ANSIBLE VERSION: ${ANSIBLE_VERSION}" + echo "#############################################" + echo "" + ANSIBLE_NO_STABLE="${ANSIBLE_VERSION//stable-/}" + ANSIBLE_NO_DOT="${ANSIBLE_NO_STABLE//./}" + PYTHON_NO_DOT="${TRAVIS_PYTHON_VERSION//./}" + IMAGE_NAME="cics-python-$PYTHON_NO_DOT-ansible-$ANSIBLE_NO_DOT" + + echo "$ARTIFACTORY_TOKEN" | docker login --username $ARTIFACTORY_USER --password-stdin $DOCKER_REGISTRY + docker pull $DOCKER_REGISTRY/$IMAGE_NAME:latest + + bash "$TRAVIS_BUILD_DIR"/.travis/build_env.sh + + docker run --rm -it -v \ + $(pwd):/root/ansible_collections/ibm/ibm_zos_cics \ + -e TRAVIS_PYTHON_VERSION=$TRAVIS_PYTHON_VERSION \ + $DOCKER_REGISTRY/$IMAGE_NAME:latest \ + bash -c "cd /root/ansible_collections/ibm/ibm_zos_cics && bash .travis/build_and_test.sh" diff --git a/.travis/build_and_test.sh b/.travis/build_and_test.sh new file mode 100755 index 00000000..9655e1a2 --- /dev/null +++ b/.travis/build_and_test.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +set -e + +git config --global --add safe.directory /root/ansible_collections/ibm/ibm_zos_cics + +pip install -r /root/ansible_collections/ibm/ibm_zos_cics/dev-requirements.txt + +# ansible-lint requires python >= 3.8 +if [ "$TRAVIS_PYTHON_VERSION" != "2.7" ]; then + echo "" + echo "##########################################################" + echo "###################### Ansible-lint ######################" + echo "##########################################################" + echo "" + ansible-lint +fi + +echo "" +echo "##########################################################" +echo "################## Ansible Sanity Tests ##################" +echo "##########################################################" +echo "" +ansible-test sanity --python "$TRAVIS_PYTHON_VERSION" + +echo "" +echo "##########################################################" +echo "################### Ansible Unit Tests ###################" +echo "##########################################################" +echo "" +ansible-test units --python "$TRAVIS_PYTHON_VERSION" + +echo "" +echo "###########################################################" +echo "################ Ansible Integration Tests ################" +echo "###########################################################" +echo "" +ansible-test integration cics_cmci --python "$TRAVIS_PYTHON_VERSION" + +echo "" +echo "##########################################################" +echo "############## Ansible Missing Module Tests ##############" +echo "##########################################################" +echo "" +pip uninstall xmltodict -y +ansible-test integration cics_cmci_missing_xmltodict_library --python "$TRAVIS_PYTHON_VERSION" + +pip install -r /root/ansible_collections/ibm/ibm_zos_cics/dev-requirements.txt +pip uninstall requests -y +ansible-test integration cics_cmci_missing_requests_library --python "$TRAVIS_PYTHON_VERSION" + +echo "" +echo "###########################################################" +echo "#################### Build Collection #####################" +echo "###########################################################" +echo "" +pip install -r /root/ansible_collections/ibm/ibm_zos_cics/dev-requirements.txt +ansible-galaxy collection build /root/ansible_collections/ibm/ibm_zos_cics --output-path /root/ansible_collections/ibm/ibm_zos_cics --force +ansible-galaxy collection install /root/ansible_collections/ibm/ibm_zos_cics/ibm-ibm_zos_cics-* --force diff --git a/.travis/build_env.sh b/.travis/build_env.sh new file mode 100755 index 00000000..a004370e --- /dev/null +++ b/.travis/build_env.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +A="A" +B="B" +star="*" + +TRAVIS_NO_DOT="${TRAVIS_JOB_NUMBER//./D}" + +program_name_1="A$TRAVIS_NO_DOT$A" +program_name_2="A$TRAVIS_NO_DOT$B" +program_filter="A$TRAVIS_NO_DOT$star" + +echo "" +echo "################ Job-Specific Variables ################" +echo "## Program 1 Name: $program_name_1" +echo "## Program 2 Name: $program_name_2" +echo "## Program Filter: $program_filter" +echo "" + +echo "############# Creating cmci-variables.yml #############" +touch "$TRAVIS_BUILD_DIR"/tests/integration/targets/cics_cmci/cmci-variables.yml +{ + echo cmci_host: "$CMCI_HOST" + echo cmci_port: "$CMCI_PORT" + echo cmci_secure_port: "$CMCI_SECURE_PORT" + echo cmci_user: "$CMCI_USER" + echo cmci_password: "$CMCI_PASSWORD" + echo cmci_context: "$CMCI_CONTEXT" + echo cmci_scope: "$CMCI_SCOPE" + echo cmci_scope_region_1: "$CMCI_SCOPE_REGION_1" + echo cmci_scope_region_2: "$CMCI_SCOPE_REGION_2" + echo cmci_program_name_1: "$program_name_1" + echo cmci_program_name_2: "$program_name_2" + echo cmci_program_filter: "$program_filter" +} >>"$TRAVIS_BUILD_DIR"/tests/integration/targets/cics_cmci/cmci-variables.yml diff --git a/.travis/get_artifactory_creds.sh b/.travis/get_artifactory_creds.sh new file mode 100755 index 00000000..350e77cb --- /dev/null +++ b/.travis/get_artifactory_creds.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +# Wiki page on Vault Integration: +# https://cicswiki.hursley.ibm.com:9443/wiki/CICS_Explorer/artifactory_vault + +VAULT_ONETIME_TOKEN=$(curl -k -s --request POST --data '{"role_id":"'"$VAULT_ROLE_ID"'","secret_id":"'"$VAULT_SECRET_ID"'"}' "$VAULT_URL"/auth/approle/login | jq -r ".auth.client_token") +ARTI=$(curl -k -s --header "X-Vault-Token: $VAULT_ONETIME_TOKEN" "$VAULT_URL"/"$VAULT_PATH" | jq -r ".data.data") +export "ARTIFACTORY_USER"="$(jq -r ".user" <<<"$ARTI")" +export "ARTIFACTORY_TOKEN"="$(jq -r ".token" <<<"$ARTI")" From a222502d3d61b6120c1b5ecde31e0683f0911434 Mon Sep 17 00:00:00 2001 From: Andrew Twydell Date: Wed, 29 Mar 2023 16:38:07 +0100 Subject: [PATCH 03/14] extract doc requirements to new file Signed-off-by: Andrew Twydell --- dev-requirements.txt | 7 ++----- doc-requirements.txt | 7 +++++++ 2 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 doc-requirements.txt diff --git a/dev-requirements.txt b/dev-requirements.txt index 4e6c8553..ddea64ae 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,4 @@ -# (c) Copyright IBM Corp. 2020,2021 +# (c) Copyright IBM Corp. 2020,2023 # Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) -r requirements.txt # ansible-core==2.13.7; python_version >= '3' @@ -16,10 +16,7 @@ shellcheck-py==0.9.0.2; python_version >= '3' rstcheck==3.3.1; python_version >= '3' yamllint==1.29.0; python_version >= '3' voluptuous==0.13.1; python_version >= '3' -ansible-doc-extractor==0.1.6; python_version >= '3' # needed to lint devel ansible version ansible-lint==6.12.2; python_version >= '3' and python_version < '3.9' ansible-lint==6.13.1; python_version >= '3.9' -pycodestyle==2.10.0; python_version >= '3' -Sphinx==3.4.3; python_version >= '3' -sphinx-rtd-theme==0.5.1; python_version >= '3' \ No newline at end of file +pycodestyle==2.10.0; python_version >= '3' \ No newline at end of file diff --git a/doc-requirements.txt b/doc-requirements.txt new file mode 100644 index 00000000..f7af10f9 --- /dev/null +++ b/doc-requirements.txt @@ -0,0 +1,7 @@ +# (c) Copyright IBM Corp. 2020,2023 +# Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) +-r dev-requirements.txt + +ansible-doc-extractor==0.1.6; python_version >= '3' +Sphinx==3.4.3; python_version >= '3' +sphinx-rtd-theme==0.5.1; python_version >= '3' \ No newline at end of file From c046ac05aa317364358cea25f988c9c02ef602f7 Mon Sep 17 00:00:00 2001 From: Andrew Twydell Date: Wed, 29 Mar 2023 16:38:33 +0100 Subject: [PATCH 04/14] add module defaults doc section Signed-off-by: Andrew Twydell --- docs/source/playbooks.rst | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/docs/source/playbooks.rst b/docs/source/playbooks.rst index e944219d..90153433 100644 --- a/docs/source/playbooks.rst +++ b/docs/source/playbooks.rst @@ -1,5 +1,5 @@ .. ............................................................................... -.. © Copyright IBM Corporation 2020 . +.. © Copyright IBM Corporation 2020,2023 . .. Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) . .. ............................................................................... @@ -173,6 +173,40 @@ The included sample variables file (all.yml) looks like this: +Module Defaults +--------------- + +Ansible has a module defaults feature to use the same values during every use of +a task, rather than repeating the values. Here we can set the host url and +credentials of the **cmci_get** task to be the same throughout the playbook. + +.. code-block:: yaml + module_defaults: + ibm.ibm_zos_cics.cmci_get: + cmci_host: "{{ cmci_host }}" + cmci_user: "{{ cmci_user }}" + cmci_password: "{{ cmci_password }}" + + +If you wish to use the same values in **all** CMCI tasks, you can assign them +to the group called **cmci_group**. + +.. code-block:: yaml + + module_defaults: + group/ibm.ibm_zos_cics.cmci_group: + cmci_host: "my.system.host" + cmci_port: "system.port.number" + cmci_user: "my.username" + cmci_password: "my.password" + +.. note:: + Group module defaults are only available in ``ansible-core`` 2.12 or later. If + this syntax is used with ``ansible-core`` 2.11 or earlier, the values are + perceived as not present, and a 'missing required arguments' error is thrown. + + + Run the playbook ---------------- From 806c482a4ff7b07dedb7ddc87df0014b5d8b5c73 Mon Sep 17 00:00:00 2001 From: Andrew Twydell Date: Wed, 29 Mar 2023 16:39:01 +0100 Subject: [PATCH 05/14] increase minimum ansible version to 2.11 Signed-off-by: Andrew Twydell --- .travis/build_and_test.sh | 2 +- docs/source/playbooks.rst | 6 +++--- meta/runtime.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis/build_and_test.sh b/.travis/build_and_test.sh index 9655e1a2..c024fe1c 100755 --- a/.travis/build_and_test.sh +++ b/.travis/build_and_test.sh @@ -13,7 +13,7 @@ if [ "$TRAVIS_PYTHON_VERSION" != "2.7" ]; then echo "###################### Ansible-lint ######################" echo "##########################################################" echo "" - ansible-lint + ansible-lint --profile production fi echo "" diff --git a/docs/source/playbooks.rst b/docs/source/playbooks.rst index 90153433..2dc03a74 100644 --- a/docs/source/playbooks.rst +++ b/docs/source/playbooks.rst @@ -177,8 +177,8 @@ Module Defaults --------------- Ansible has a module defaults feature to use the same values during every use of -a task, rather than repeating the values. Here we can set the host url and -credentials of the **cmci_get** task to be the same throughout the playbook. +a module, rather than repeating them everytime. Here we can set the host url and +credentials of the **cmci_get** module to be the same throughout the playbook. .. code-block:: yaml module_defaults: @@ -188,7 +188,7 @@ credentials of the **cmci_get** task to be the same throughout the playbook. cmci_password: "{{ cmci_password }}" -If you wish to use the same values in **all** CMCI tasks, you can assign them +If you wish to use the same values in **all** CMCI modules, you can assign them to the group called **cmci_group**. .. code-block:: yaml diff --git a/meta/runtime.yml b/meta/runtime.yml index 05653156..227c7f94 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,5 +1,5 @@ --- -requires_ansible: ">=2.10.7" +requires_ansible: ">=2.11" action_groups: cmci_group: - cmci_action From c51654c1ae97081db5b307e709023fc5e8e1ee34 Mon Sep 17 00:00:00 2001 From: Andrew Twydell Date: Tue, 18 Apr 2023 14:07:47 +0100 Subject: [PATCH 06/14] changed docs to refer to samples repo Signed-off-by: Andrew Twydell --- docs/source/index.rst | 11 ++-- docs/source/installation.rst | 3 +- docs/source/playbooks.rst | 103 +++++++++++++++++++--------------- docs/source/release_notes.rst | 4 +- docs/source/requirements.rst | 4 +- docs/templates/module.rst.j2 | 6 +- 6 files changed, 70 insertions(+), 61 deletions(-) diff --git a/docs/source/index.rst b/docs/source/index.rst index 6c27ce48..623c3014 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1,5 +1,5 @@ .. ............................................................................... -.. © Copyright IBM Corporation 2020,2021 . +.. © Copyright IBM Corporation 2020,2023 . .. Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) . .. ............................................................................... @@ -32,14 +32,13 @@ The **The IBM z/OS CICS collection** is following the **Red Hat Ansible Certifie Features ================ -The IBM z/OS CICS collection includes `modules`_, `sample playbooks`_, and ansible-doc to automate tasks against CICS resources and definitions. - +The IBM z/OS CICS collection includes `modules`_ and ansible-doc to automate tasks against CICS resources and definitions. There are also samples in the `Z Ansible collection samples repository`_ for core z/OS, CICS, and other z/OS subsystems. .. _modules: - https://github.com/ansible-collections/ibm_zos_cics/tree/master/plugins/modules/ -.. _sample playbooks: - https://github.com/ansible-collections/ibm_zos_cics/tree/master/playbooks/ + https://github.com/ansible-collections/ibm_zos_cics/tree/main/plugins/modules/ +.. _Z Ansible collection samples repository: + https://github.com/IBM/z_ansible_collections_samples Copyright diff --git a/docs/source/installation.rst b/docs/source/installation.rst index 1c8cf402..fa2eebf2 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -1,5 +1,5 @@ .. ............................................................................... -.. © Copyright IBM Corporation 2020,2021 . +.. © Copyright IBM Corporation 2020,2023 . .. Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) . .. ............................................................................... @@ -31,7 +31,6 @@ By default, collections are installed in ``~/.ansible/collections``. After insta │ ├── ibm/ │ ├── ibm_zos_cics/ │ ├── docs/ - │ ├── playbooks/ │ ├── plugins/ │ ├── action/ │ ├── module_utils/ diff --git a/docs/source/playbooks.rst b/docs/source/playbooks.rst index 2dc03a74..a83eb287 100644 --- a/docs/source/playbooks.rst +++ b/docs/source/playbooks.rst @@ -6,8 +6,13 @@ Playbooks ========= -The sample playbooks that are **included** in the **IBM z/OS CICS collection** -demonstrate how to use the collection content. +There are sample playbooks that demonstrate the **IBM z/OS CICS collection** +functionality in the `samples repository`_. + +.. _samples repository: + https://github.com/IBM/z_ansible_collections_samples + + Playbook Documentation ---------------------- @@ -15,10 +20,10 @@ Playbook Documentation An `Ansible playbook`_ consists of organized instructions that define work for a managed node (host) to be managed with Ansible. -A `playbooks directory`_ that contains a sample playbook is included in the -**IBM z/OS CICS collection**. The sample playbook is for reference and can be run -with the ``ansible-playbook`` command with some modification to the **inventory**, -**ansible.cfg** and **group_vars** as well as updates to the module parameters +`Samples`_ that contains multiple example playbooks are included in the +`CICS samples repository`_. The sample playbooks are for reference and can be run +with the ``ansible-playbook`` command with some modification to their **inventory**, +**ansible.cfg** and **group_vars** as well as updates to their module parameters to reference your CICS artifacts and configuration. You can find the playbook content that is included with the collection in the @@ -29,12 +34,15 @@ refer to the installation path as ``~/.ansible/collections/ibm/ibm_zos_cics``. .. _Ansible playbook: https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html#playbooks-intro -.. _playbooks directory: - https://github.com/ansible-collections/ibm_zos_cics/tree/master/playbooks +.. _Samples: + https://github.com/IBM/z_ansible_collections_samples/tree/main/zos_subsystems/cics +.. _CICS samples repository: + https://github.com/IBM/z_ansible_collections_samples .. _installation documentation: installation.html + Sample Configuration and Setup ------------------------------ Each release of Ansible provides options in addition to the ones identified in @@ -43,18 +51,14 @@ allow you to customize how Ansible operates in your environment. Ansible supports several sources to configure its behavior and all sources follow the Ansible `precedence rules`_. -The Ansible configuration file `ansible.cfg` can override almost all -``ansible-playbook`` configurations. Included in the `playbooks directory`_ is a -sample `ansible.cfg`_ that can supplement ``ansible-playbook`` with a -little modification. In the sample `ansible.cfg`_, the only required -configuration is ``pipelining = True``. +The Ansible configuration file ``ansible.cfg`` can override almost all +``ansible-playbook`` configurations. You can specify the SSH port used by Ansible and instruct Ansible where to write the temporary files on the target. This can be easily done by adding the -options to your inventory or `ansible.cfg`. +options to your inventory or ``ansible.cfg``. -An example of adding these options to `ansible.cfg` is shown below. For more -details, see the sample `ansible.cfg`_ notes. +An example of adding these options to ``ansible.cfg`` is shown below. .. code-block:: yaml @@ -66,13 +70,13 @@ details, see the sample `ansible.cfg`_ notes. For more information about available configurations for ``ansible.cfg``, read the Ansible documentation on `Ansible configuration settings`_. -.. _ansible.cfg: - https://github.com/ansible-collections/ibm_zos_cics/blob/master/playbooks/ansible.cfg .. _Ansible configuration settings: https://docs.ansible.com/ansible/latest/reference_appendices/config.html#ansible-configuration-settings-locations .. _precedence rules: https://docs.ansible.com/ansible/latest/reference_appendices/general_precedence.html#general-precedence-rules + + Inventory --------- @@ -81,15 +85,15 @@ list or group of lists known as an `inventory`_. Once the inventory is defined, you can use `patterns`_ to select the hosts or groups that you want Ansible to run against. -Included in the `playbooks directory`_ is a `sample inventory file`_ that can be -used to manage your nodes with a little modification. This inventory file -should be included when running the sample playbook. +Included in the `CMCI samples repository`_ is a `sample inventory file`_ +that can be used to manage your nodes with a little modification. This +inventory file should be included when running the sample playbook. .. code-block:: yaml - zsystem: + source_system: hosts: - zvm: + zos_host: ansible_host: zos_target_address ansible_user: zos_target_username ansible_python_interpreter: path_to_python_interpreter_binary_on_zos_target @@ -115,23 +119,26 @@ to set the port for a host can be reviewed in the .. _inventory: https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html +.. _CMCI samples repository: + https://github.com/IBM/z_ansible_collections_samples/blob/main/zos_subsystems/cics/cmci .. _patterns: https://docs.ansible.com/ansible/latest/user_guide/intro_patterns.html#intro-patterns .. _sample inventory file: - https://github.com/ansible-collections/ibm_zos_cics/blob/master/playbooks/inventory + https://github.com/IBM/z_ansible_collections_samples/blob/main/zos_subsystems/cics/cmci/deploy_program/inventory.yml .. _FAQ: https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#running-on-z-os .. _behavioral inventory parameters: https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#connecting-to-hosts-behavioral-inventory-parameters + Group_vars ---------- Although you can store variables in the inventory file, storing separate host and group variables files may help you organize your variable values more easily. Included with the sample playbook is a sample variables -file `all.yml`_. +file `zos_host.yml`_. The value for the property **BPXK_AUTOCVT** must be configured to ``ON``. @@ -150,7 +157,8 @@ The value for the property **PATH** is the ZOA utilities BIN path and the Python interpreter path; for example, ``/usr/lpp/IBM/zoautil/bin:/usr/lpp/rsusr/python36/bin/python:/bin``. -The included sample variables file (all.yml) looks like this: +The included sample variables file (zos_host.yml) contains variables specific to +the playbook as well as the following: .. code-block:: yaml @@ -168,8 +176,8 @@ The included sample variables file (all.yml) looks like this: **ZOAU_ROOT** which is the ZOA Utilities install root path required for ZOAU; for example, ``/usr/lpp/IBM/zoautil``. -.. _all.yml: - https://github.com/ansible-collections/ibm_zos_cics/blob/master/playbooks/group_vars/all.yml +.. _zos_host.yml: + https://github.com/IBM/z_ansible_collections_samples/blob/main/zos_subsystems/cics/cmci/deploy_program/host_vars/zos_host.yml @@ -181,11 +189,12 @@ a module, rather than repeating them everytime. Here we can set the host url and credentials of the **cmci_get** module to be the same throughout the playbook. .. code-block:: yaml + module_defaults: - ibm.ibm_zos_cics.cmci_get: - cmci_host: "{{ cmci_host }}" - cmci_user: "{{ cmci_user }}" - cmci_password: "{{ cmci_password }}" + ibm.ibm_zos_cics.cmci_get: + cmci_host: "{{ cmci_host }}" + cmci_user: "{{ cmci_user }}" + cmci_password: "{{ cmci_password }}" If you wish to use the same values in **all** CMCI modules, you can assign them @@ -194,11 +203,11 @@ to the group called **cmci_group**. .. code-block:: yaml module_defaults: - group/ibm.ibm_zos_cics.cmci_group: - cmci_host: "my.system.host" - cmci_port: "system.port.number" - cmci_user: "my.username" - cmci_password: "my.password" + group/ibm.ibm_zos_cics.cmci_group: + cmci_host: "my.system.host" + cmci_port: "system.port.number" + cmci_user: "my.username" + cmci_password: "my.password" .. note:: Group module defaults are only available in ``ansible-core`` 2.12 or later. If @@ -210,13 +219,14 @@ to the group called **cmci_group**. Run the playbook ---------------- -Access the sample Ansible playbook and ensure that you are within the collection -playbooks directory where the sample files are included: -``~/.ansible/collections/ibm/ibm_zos_cics/playbooks/``. +Access the `collection samples repository`_ and ensure you have navigated to +the directory containing the playbook you want to run. For example: +``zos_subsystems/cics/cmci/deploy_program/``. Use the Ansible command ``ansible-playbook`` to run the sample playbook. The -command syntax is ``ansible-playbook -i ``; for example, -``ansible-playbook -i inventory zos-collection-sample.yaml``. +command syntax is ``ansible-playbook -i `` which, using +the example above of deploy_program, is +``ansible-playbook -i inventory deploy_program.yaml``. This command assumes that the controller's public SSH key has been shared with the managed node. If you want to avoid entering a username and password each @@ -225,7 +235,7 @@ command; for example, ``ssh-copy-id -i ~/.ssh/mykey.pub user@``. Alternatively, you can use the ``--ask-pass`` option to be prompted for the user's password each time a playbook is run; for example, -``ansible-playbook -i inventory zos-collection-sample.yaml --ask-pass``. +``ansible-playbook -i inventory deploy_program.yaml --ask-pass``. .. note:: * Using ``--ask-pass`` is not recommended because it will hinder performance. @@ -249,7 +259,7 @@ ERROR, DEBUG. Review the playbook notes sections for additional details and configuration. - Sample playbooks often submit JCL that is included with this collection + Playbooks often submit JCL that is included in the samples repository under the `files directory`_. Review the sample JCL for necessary edits to allow for submission on the target system. The most common changes are to add a CLASS parameter and change the NOTIFY user parameter. For more details, @@ -257,6 +267,7 @@ ERROR, DEBUG. .. _ask-pass documentation: https://linux.die.net/man/1/sshpass - +.. _collection samples repository: + https://github.com/IBM/z_ansible_collections_samples .. _files directory: - https://github.com/ansible-collections/ibm_zos_core/tree/dev/playbooks/files + https://github.com/IBM/z_ansible_collections_samples/tree/main/zos_basics/constructs/files diff --git a/docs/source/release_notes.rst b/docs/source/release_notes.rst index 74801331..18bf7362 100644 --- a/docs/source/release_notes.rst +++ b/docs/source/release_notes.rst @@ -1,5 +1,5 @@ .. ............................................................................... -.. © Copyright IBM Corporation 2020,2021 . +.. © Copyright IBM Corporation 2020,2023 . .. Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) . .. ............................................................................... @@ -50,7 +50,7 @@ This collection can manage CICS and CICSPlex® SM resources and definitions by c * Sample playbooks are available at the `samples repository`_. Each playbook contains a README that explains what configurations must be made to run a sample playbook. .. _samples repository: - https://github.com/IBM/z_ansible_collections_samples/tree/master/zos_subsystems/cics + https://github.com/IBM/z_ansible_collections_samples/tree/main/zos_subsystems/cics .. _CMCI REST API: https://www.ibm.com/docs/en/cics-ts/latest?topic=cmci-how-it-works-rest-api diff --git a/docs/source/requirements.rst b/docs/source/requirements.rst index ea708c7d..ce8c3007 100644 --- a/docs/source/requirements.rst +++ b/docs/source/requirements.rst @@ -1,5 +1,5 @@ .. ............................................................................... -.. © Copyright IBM Corporation 2020,2021 . +.. © Copyright IBM Corporation 2020,2023 . .. Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) . .. ............................................................................... @@ -15,7 +15,7 @@ A control node is any machine with Ansible® installed. You can run commands and .. note:: The IBM® z/OS® CICS® collection cannot run on a Windows system. -* `Ansible version`_: 2.9 or later +* `Ansible version`_: 2.11 or later * `Python`_: 2.7 or later diff --git a/docs/templates/module.rst.j2 b/docs/templates/module.rst.j2 index 599c9d1c..dcc5e1e4 100644 --- a/docs/templates/module.rst.j2 +++ b/docs/templates/module.rst.j2 @@ -1,13 +1,13 @@ {# ---------------------------------------------------------------------------- #} -{# © Copyright IBM Corporation 2020 #} +{# © Copyright IBM Corporation 2020,2023 #} {# Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) #} {# ---------------------------------------------------------------------------- #} .. ............................................................................... -.. © Copyright IBM Corporation 2020 . +.. © Copyright IBM Corporation 2020,2023 . .. Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) . .. ............................................................................... -:github_url: https://github.com/ansible-collections/ibm_zos_cics/blob/dev/plugins/modules/{{ module }}.py +:github_url: https://github.com/ansible-collections/ibm_zos_cics/blob/main/plugins/modules/{{ module }}.py .. _{{ module }}_module: From 55089274d805cf14db1784227c671d77f742fc5f Mon Sep 17 00:00:00 2001 From: Andrew Twydell Date: Tue, 18 Apr 2023 15:42:55 +0100 Subject: [PATCH 07/14] suggested wording changes Signed-off-by: Andrew Twydell --- docs/source/playbooks.rst | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/docs/source/playbooks.rst b/docs/source/playbooks.rst index a83eb287..cf9ab176 100644 --- a/docs/source/playbooks.rst +++ b/docs/source/playbooks.rst @@ -21,7 +21,7 @@ An `Ansible playbook`_ consists of organized instructions that define work for a managed node (host) to be managed with Ansible. `Samples`_ that contains multiple example playbooks are included in the -`CICS samples repository`_. The sample playbooks are for reference and can be run +`Ansible Z playbook repository`_. The sample playbooks are for reference and can be run with the ``ansible-playbook`` command with some modification to their **inventory**, **ansible.cfg** and **group_vars** as well as updates to their module parameters to reference your CICS artifacts and configuration. @@ -36,7 +36,7 @@ refer to the installation path as ``~/.ansible/collections/ibm/ibm_zos_cics``. https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html#playbooks-intro .. _Samples: https://github.com/IBM/z_ansible_collections_samples/tree/main/zos_subsystems/cics -.. _CICS samples repository: +.. _Ansible Z playbook repository: https://github.com/IBM/z_ansible_collections_samples .. _installation documentation: installation.html @@ -85,9 +85,9 @@ list or group of lists known as an `inventory`_. Once the inventory is defined, you can use `patterns`_ to select the hosts or groups that you want Ansible to run against. -Included in the `CMCI samples repository`_ is a `sample inventory file`_ -that can be used to manage your nodes with a little modification. This -inventory file should be included when running the sample playbook. +Included in the CICS `deploy program sample`_ is an example `inventory file`_ +which shows how host information is supplied to Ansible. It looks like the +following: .. code-block:: yaml @@ -119,11 +119,11 @@ to set the port for a host can be reviewed in the .. _inventory: https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html -.. _CMCI samples repository: - https://github.com/IBM/z_ansible_collections_samples/blob/main/zos_subsystems/cics/cmci .. _patterns: https://docs.ansible.com/ansible/latest/user_guide/intro_patterns.html#intro-patterns -.. _sample inventory file: +.. _deploy program sample: + https://github.com/IBM/z_ansible_collections_samples/blob/main/zos_subsystems/cics/cmci/deploy_program +.. _inventory file: https://github.com/IBM/z_ansible_collections_samples/blob/main/zos_subsystems/cics/cmci/deploy_program/inventory.yml .. _FAQ: https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#running-on-z-os @@ -137,8 +137,9 @@ Group_vars Although you can store variables in the inventory file, storing separate host and group variables files may help you organize your variable values more -easily. Included with the sample playbook is a sample variables -file `zos_host.yml`_. +easily. An example of one of these variable files is the `zos_host.yml`_ +file included with the `deploy_program sample`_, which is used to provide the +required environment variables. The value for the property **BPXK_AUTOCVT** must be configured to ``ON``. @@ -178,6 +179,8 @@ the playbook as well as the following: .. _zos_host.yml: https://github.com/IBM/z_ansible_collections_samples/blob/main/zos_subsystems/cics/cmci/deploy_program/host_vars/zos_host.yml +.. _deploy_program sample: + https://github.com/IBM/z_ansible_collections_samples/blob/main/zos_subsystems/cics/cmci/deploy_program @@ -225,7 +228,7 @@ the directory containing the playbook you want to run. For example: Use the Ansible command ``ansible-playbook`` to run the sample playbook. The command syntax is ``ansible-playbook -i `` which, using -the example above of deploy_program, is +the example above of ``deploy_program``, is ``ansible-playbook -i inventory deploy_program.yaml``. This command assumes that the controller's public SSH key has been shared with From c51bf9935178275e31c0a4e519ddf7d5792b57fc Mon Sep 17 00:00:00 2001 From: Andrew Twydell Date: Wed, 19 Apr 2023 16:49:43 +0100 Subject: [PATCH 08/14] pull cmci creds from vault Signed-off-by: Andrew Twydell --- .travis/build_env.sh | 6 +++--- .travis/get_artifactory_creds.sh | 9 --------- .travis/get_vault_data.sh | 22 ++++++++++++++++++++++ 3 files changed, 25 insertions(+), 12 deletions(-) delete mode 100755 .travis/get_artifactory_creds.sh create mode 100755 .travis/get_vault_data.sh diff --git a/.travis/build_env.sh b/.travis/build_env.sh index a004370e..58badf81 100755 --- a/.travis/build_env.sh +++ b/.travis/build_env.sh @@ -24,11 +24,11 @@ touch "$TRAVIS_BUILD_DIR"/tests/integration/targets/cics_cmci/cmci-variables.yml echo cmci_port: "$CMCI_PORT" echo cmci_secure_port: "$CMCI_SECURE_PORT" echo cmci_user: "$CMCI_USER" - echo cmci_password: "$CMCI_PASSWORD" + echo cmci_password: "$CMCI_PASS" echo cmci_context: "$CMCI_CONTEXT" echo cmci_scope: "$CMCI_SCOPE" - echo cmci_scope_region_1: "$CMCI_SCOPE_REGION_1" - echo cmci_scope_region_2: "$CMCI_SCOPE_REGION_2" + echo cmci_scope_region_1: "$CMCI_REGION_1" + echo cmci_scope_region_2: "$CMCI_REGION_2" echo cmci_program_name_1: "$program_name_1" echo cmci_program_name_2: "$program_name_2" echo cmci_program_filter: "$program_filter" diff --git a/.travis/get_artifactory_creds.sh b/.travis/get_artifactory_creds.sh deleted file mode 100755 index 350e77cb..00000000 --- a/.travis/get_artifactory_creds.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -# Wiki page on Vault Integration: -# https://cicswiki.hursley.ibm.com:9443/wiki/CICS_Explorer/artifactory_vault - -VAULT_ONETIME_TOKEN=$(curl -k -s --request POST --data '{"role_id":"'"$VAULT_ROLE_ID"'","secret_id":"'"$VAULT_SECRET_ID"'"}' "$VAULT_URL"/auth/approle/login | jq -r ".auth.client_token") -ARTI=$(curl -k -s --header "X-Vault-Token: $VAULT_ONETIME_TOKEN" "$VAULT_URL"/"$VAULT_PATH" | jq -r ".data.data") -export "ARTIFACTORY_USER"="$(jq -r ".user" <<<"$ARTI")" -export "ARTIFACTORY_TOKEN"="$(jq -r ".token" <<<"$ARTI")" diff --git a/.travis/get_vault_data.sh b/.travis/get_vault_data.sh new file mode 100755 index 00000000..7a3af9ca --- /dev/null +++ b/.travis/get_vault_data.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +# Wiki page on Vault Integration: +# https://cicswiki.hursley.ibm.com:9443/wiki/CICS_Explorer/artifactory_vault + +VAULT_ONETIME_TOKEN=$(curl -k -s --request POST --data '{"role_id":"'"$VAULT_ROLE_ID"'","secret_id":"'"$VAULT_SECRET_ID"'"}' "$VAULT_URL"/auth/approle/login | jq -r ".auth.client_token") +ARTI=$(curl -k -s --header "X-Vault-Token: $VAULT_ONETIME_TOKEN" "$VAULT_URL"/"$VAULT_PATH"/"artifactory" | jq -r ".data.data") +export "ARTIFACTORY_USER"="$(jq -r ".user" <<<"$ARTI")" +export "ARTIFACTORY_TOKEN"="$(jq -r ".token" <<<"$ARTI")" + +PLEX=$(curl -k -s --header "X-Vault-Token: $VAULT_ONETIME_TOKEN" "$VAULT_URL"/"$VAULT_PATH"/plex2 | jq -r ".data.data") +export "CMCI_USER"="$(jq -r ".username" <<<"$PLEX")" +export "CMCI_PASS"="$(jq -r ".password" <<<"$PLEX")" + +CMCI=$(curl -k -s --header "X-Vault-Token: $VAULT_ONETIME_TOKEN" "$VAULT_URL"/"$VAULT_PATH"/cmci | jq -r ".data.data") +export "CMCI_HOST"="$(jq -r ".url" <<<"$CMCI")" +export "CMCI_PORT"="$(jq -r ".port" <<<"$CMCI")" +export "CMCI_SECURE_PORT"="$(jq -r ".secure_port" <<<"$CMCI")" +export "CMCI_SCOPE"="$(jq -r ".scope" <<<"$CMCI")" +export "CMCI_REGION_1"="$(jq -r ".region_1" <<<"$CMCI")" +export "CMCI_REGION_2"="$(jq -r ".region_2" <<<"$CMCI")" +export "CMCI_CONTEXT"="$(jq -r ".context" <<<"$CMCI")" From a66905b08801dd21aaa6fff76c30a089405914c7 Mon Sep 17 00:00:00 2001 From: Andrew Twydell Date: Wed, 19 Apr 2023 16:50:15 +0100 Subject: [PATCH 09/14] push builds to artifactory Signed-off-by: Andrew Twydell --- .ansible-lint | 1 + .travis.yml | 11 ++++++++++- .travis/push_artifactory.sh | 29 +++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100755 .travis/push_artifactory.sh diff --git a/.ansible-lint b/.ansible-lint index c476b360..ba30efa8 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -3,6 +3,7 @@ skip_list: - "name[template]" - "args[module]" - "yaml[line-length]" + - "yaml[truthy]" - "galaxy[no-changelog]" - "meta-unsupported-ansible" - "meta-runtime[unsupported-version]" diff --git a/.travis.yml b/.travis.yml index 4c81c7e4..8ed1994e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,7 @@ matrix: env: ANSIBLE_VERSION="stable-2.11" services: - docker -before_script: source .travis/get_artifactory_creds.sh +before_script: source .travis/get_vault_data.sh script: | echo "" echo "#############################################" @@ -54,3 +54,12 @@ script: | -e TRAVIS_PYTHON_VERSION=$TRAVIS_PYTHON_VERSION \ $DOCKER_REGISTRY/$IMAGE_NAME:latest \ bash -c "cd /root/ansible_collections/ibm/ibm_zos_cics && bash .travis/build_and_test.sh" + +jobs: + include: + - stage: deploy + script: bash .travis/push_artifactory.sh + python: "3.10" + env: ANSIBLE_VERSION="stable-2.14" + on: + branch: main diff --git a/.travis/push_artifactory.sh b/.travis/push_artifactory.sh new file mode 100755 index 00000000..cb93053a --- /dev/null +++ b/.travis/push_artifactory.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +set -e + +pip install https://github.com/ansible/ansible/archive/stable-2.14.tar.gz + +ansible-galaxy collection build "$TRAVIS_BUILD_DIR" --force + +file_with_prefix="$(find . -type f -iname "ibm-ibm_zos_cics-*")" +file="${file_with_prefix//.\//}" +no_extension="${file//.tar.gz/}" +no_starting="${no_extension//.\//}" +version_number="${no_starting//ibm-ibm_zos_cics-/}" +TRAVIS_NO_DOT="${TRAVIS_JOB_NUMBER//./D}" + +echo "" +echo "##########################################################" +echo "############# Uploading build to Artifactory #############" +echo "##########################################################" +echo "#" +echo "# File: $file" +echo "# Version: $version_number" +echo "#" +echo "##########################################################" + +curl -ksSf \ + -H "Authorization: Bearer $ARTIFACTORY_TOKEN" -X PUT \ + -T "$TRAVIS_BUILD_DIR"/"$file" \ + "$ARTIFACTORY_URL"/"$version_number"/"$TRAVIS_NO_DOT"/"$file" From 9b94b0b64926d1b07eed5dac13fd895bf3edd56f Mon Sep 17 00:00:00 2001 From: Andrew Twydell Date: Wed, 19 Apr 2023 16:50:46 +0100 Subject: [PATCH 10/14] bump version to 1.0.4 for release Signed-off-by: Andrew Twydell --- docs/source/release_notes.rst | 12 ++++++++++++ galaxy.yml | 3 ++- meta/ibm_zos_cics_meta.yml | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/source/release_notes.rst b/docs/source/release_notes.rst index 18bf7362..099da9cd 100644 --- a/docs/source/release_notes.rst +++ b/docs/source/release_notes.rst @@ -7,6 +7,18 @@ Releases ======== +Version 1.0.4 +============= +What's New +------------------- +* Provide variables for all modules in one go using Ansible's `group module defaults`_ support. The group name for the CMCI modules is ``cmci_group``. + +* Prevent ``cmci_get`` from failing if no records are found via the ``fail_on_nodata`` option. The default value is true if not specified. + +.. _group module defaults: + https://docs.ansible.com/ansible/2.8/user_guide/playbooks_module_defaults.html#module-defaults-groups + + Version 1.0.3 ============= diff --git a/galaxy.yml b/galaxy.yml index 60b5a4f4..718d6c36 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -8,7 +8,7 @@ namespace: ibm name: ibm_zos_cics # The collection version -version: 1.0.3 +version: 1.0.4 # Collection README file readme: README.md @@ -59,6 +59,7 @@ build_ignore: - build.sh - requirements.txt - dev-requirements.txt + - doc-requirements.txt - devguide.md - .travis - .github diff --git a/meta/ibm_zos_cics_meta.yml b/meta/ibm_zos_cics_meta.yml index a8fc6013..e1d3facb 100644 --- a/meta/ibm_zos_cics_meta.yml +++ b/meta/ibm_zos_cics_meta.yml @@ -1,6 +1,6 @@ --- name: ibm_zos_cics -version: 1.0.3 +version: 1.0.4 managed_requirements: - name: Python version: ">=2.7" From 37525e8df7d4501e3ca115b512228be4305de772 Mon Sep 17 00:00:00 2001 From: "whitesource-ets[bot]" <409986+whitesource-ets[bot]@users.noreply.github.ibm.com> Date: Wed, 19 Apr 2023 15:06:10 +0000 Subject: [PATCH 11/14] Add .whitesource configuration file --- .whitesource | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .whitesource diff --git a/.whitesource b/.whitesource new file mode 100644 index 00000000..545628a1 --- /dev/null +++ b/.whitesource @@ -0,0 +1,3 @@ +{ + "settingsInheritedFrom": "whitesource-config/whitesource-config@master" +} \ No newline at end of file From 3035ca5d1cb40f829f21047f848d36b18b9fed57 Mon Sep 17 00:00:00 2001 From: Ben Cox Date: Wed, 19 Apr 2023 16:07:29 +0100 Subject: [PATCH 12/14] .whitesource customisation --- .whitesource | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.whitesource b/.whitesource index 545628a1..7d0b5b83 100644 --- a/.whitesource +++ b/.whitesource @@ -1,3 +1,12 @@ { - "settingsInheritedFrom": "whitesource-config/whitesource-config@master" -} \ No newline at end of file + "settingsInheritedFrom": "whitesource-config/whitesource-config@master", + "remediateSettings": { + "enableRenovate": true, + "extends": [ + "config:base" + ] + }, + "issueSettings": { + "issueRepoName": "cics-ts-tracking" + } +} From 4660dd9ba5f56b0f08b9da13ccd58493dc957d9a Mon Sep 17 00:00:00 2001 From: "whitesource-ets[bot]" Date: Wed, 19 Apr 2023 20:08:20 +0000 Subject: [PATCH 13/14] Update dependency requests to v2.28.2 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index fd3a7e19..7e7c3940 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # (c) Copyright IBM Corp. 2020,2021 # Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) -requests==2.23.0 +requests==2.28.2 xmltodict==0.12.0 typing;python_version<"3.5" \ No newline at end of file From 339e01384bef6ec34db4e20b255a7fc4ed334f48 Mon Sep 17 00:00:00 2001 From: Ben Cox Date: Wed, 19 Apr 2023 21:24:29 +0100 Subject: [PATCH 14/14] Requests 2.27.1 (maintaining Python 2.7 compat) --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 7e7c3940..3c5c5fef 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # (c) Copyright IBM Corp. 2020,2021 # Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) -requests==2.28.2 +requests==2.27.1 xmltodict==0.12.0 -typing;python_version<"3.5" \ No newline at end of file +typing;python_version<"3.5"