From 9259b4b28bcd6e6c586834f45893d4a00a080781 Mon Sep 17 00:00:00 2001 From: Rainer Leber <39616583+rainerleber@users.noreply.github.com> Date: Wed, 9 Nov 2022 09:05:52 +0100 Subject: [PATCH 1/5] fix None type bug (#20) * fix None type bug * add change log fragment --- changelogs/fragments/0020-fix_sap_control_exec.yml | 2 ++ plugins/modules/sap_control_exec.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/0020-fix_sap_control_exec.yml diff --git a/changelogs/fragments/0020-fix_sap_control_exec.yml b/changelogs/fragments/0020-fix_sap_control_exec.yml new file mode 100644 index 0000000..9808d03 --- /dev/null +++ b/changelogs/fragments/0020-fix_sap_control_exec.yml @@ -0,0 +1,2 @@ +bugfixes: + - fix a bug where some commands produces no output which cause to crash the module. \ No newline at end of file diff --git a/plugins/modules/sap_control_exec.py b/plugins/modules/sap_control_exec.py index 0467adc..90d8e59 100644 --- a/plugins/modules/sap_control_exec.py +++ b/plugins/modules/sap_control_exec.py @@ -384,7 +384,10 @@ def main(): result['msg'] = 'Something went wrong connecting to the SAPCONTROL SOAP API.' module.fail_json(**result) - returned_data = recursive_dict(conn) + if conn is not None: + returned_data = recursive_dict(conn) + else: + returned_data = conn result['changed'] = True result['msg'] = "Succesful execution of: " + function From 02a425c3ee8b9bd623f0f5e11ecff402a46bc4e4 Mon Sep 17 00:00:00 2001 From: sean-freeman Date: Fri, 11 Nov 2022 21:09:43 +0000 Subject: [PATCH 2/5] placeholder swpm1 fix --- plugins/module_utils/swpm2_parameters_inifile_generate.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/module_utils/swpm2_parameters_inifile_generate.py b/plugins/module_utils/swpm2_parameters_inifile_generate.py index 1b6ab1a..f7b72d5 100755 --- a/plugins/module_utils/swpm2_parameters_inifile_generate.py +++ b/plugins/module_utils/swpm2_parameters_inifile_generate.py @@ -68,6 +68,9 @@ def control_xml_utf8(filepath, module): string = etree.tostring(root, xml_declaration=True, encoding="UTF-8", pretty_print=True).decode('utf8').encode('iso-8859-1') +# string1 = etree.tostring(root, xml_declaration=True, encoding="UTF-8", +# pretty_print=True).decode('utf8').encode('utf-8').strip() + with open('control_utf8.xml', 'wb') as target: target.write(string) From 01b58b01ac75c376b777778b5fece9f335ecf055 Mon Sep 17 00:00:00 2001 From: Rainer Leber <39616583+rainerleber@users.noreply.github.com> Date: Mon, 5 Dec 2022 11:29:16 +0100 Subject: [PATCH 3/5] add new tests (#22) * test * add ignore, change py version * fix test * add changelog, fix before assignment * fix pyrfc before assignment * change ignore file 2.15 --- .github/workflows/ansible-test.yml | 40 +++++++------------ .../fragments/22-use-before-assignment.yml | 3 ++ plugins/modules/sap_company.py | 1 + plugins/modules/sap_control_exec.py | 1 + plugins/modules/sap_pyrfc.py | 2 + plugins/modules/sap_snote.py | 1 + plugins/modules/sap_task_list_execute.py | 2 + plugins/modules/sap_user.py | 1 + tests/sanity/ignore-2.14.txt | 9 +++++ tests/sanity/ignore-2.15.txt | 9 +++++ 10 files changed, 44 insertions(+), 25 deletions(-) create mode 100644 changelogs/fragments/22-use-before-assignment.yml create mode 100644 tests/sanity/ignore-2.14.txt create mode 100644 tests/sanity/ignore-2.15.txt diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index a0453b0..e95bb23 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -22,7 +22,13 @@ jobs: - stable-2.11 - stable-2.12 - stable-2.13 - runs-on: ubuntu-latest + - stable-2.14 + - devel + + runs-on: >- + ${{ contains(fromJson( + '["stable-2.9", "stable-2.10", "stable-2.11", "stable-2.12", "stable-2.13", "stable-2.14"]' + ), matrix.ansible) && 'ubuntu-20.04' || 'ubuntu-latest' }} steps: - name: Check out code @@ -36,37 +42,23 @@ jobs: units: - runs-on: ubuntu-latest + runs-on: >- + ${{ contains(fromJson( + '["stable-2.9", "stable-2.10", "stable-2.11", "stable-2.12", "stable-2.13", "stable-2.14"]' + ), matrix.ansible) && 'ubuntu-20.04' || 'ubuntu-latest' }} name: Units (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }}) strategy: # As soon as the first unit test fails, cancel the others to free up the CI queue fail-fast: true matrix: ansible: - - stable-2.9 # Only if your collection supports Ansible 2.9 + - stable-2.9 - stable-2.10 - stable-2.11 - stable-2.12 - stable-2.13 - python: - - 2.6 - - 2.7 - - 3.5 - - 3.6 - - 3.7 - - 3.8 - - 3.9 - exclude: - # Because ansible-test doesn't support python3.9 for Ansible 2.9 - - ansible: stable-2.9 - python: 3.9 - - ansible: stable-2.13 - python: 2.6 - include: - # Test Devel on Python 3.10 only - - ansible: devel - python: '3.10' - + - stable-2.14 + - devel steps: - name: Check out code @@ -76,8 +68,6 @@ jobs: uses: ansible-community/ansible-test-gh-action@release/v1 with: ansible-core-version: ${{ matrix.ansible }} - target-python-version: ${{ matrix.python }} - python-version: '3.10' testing-type: units test-deps: >- ansible.netcommon @@ -129,4 +119,4 @@ jobs: # testing-type: integration # test-deps: >- # ansible.netcommon - # ansible.utils + # ansible.utils \ No newline at end of file diff --git a/changelogs/fragments/22-use-before-assignment.yml b/changelogs/fragments/22-use-before-assignment.yml new file mode 100644 index 0000000..044a7e1 --- /dev/null +++ b/changelogs/fragments/22-use-before-assignment.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - modules - fix a "variable used before assignment" that cannot be reached but causes sanity test failures. \ No newline at end of file diff --git a/plugins/modules/sap_company.py b/plugins/modules/sap_company.py index 6b6f236..29b214f 100644 --- a/plugins/modules/sap_company.py +++ b/plugins/modules/sap_company.py @@ -199,6 +199,7 @@ HAS_PYRFC_LIBRARY = False ANOTHER_LIBRARY_IMPORT_ERROR = traceback.format_exc() else: + ANOTHER_LIBRARY_IMPORT_ERROR = None HAS_PYRFC_LIBRARY = True diff --git a/plugins/modules/sap_control_exec.py b/plugins/modules/sap_control_exec.py index 90d8e59..c24fa60 100644 --- a/plugins/modules/sap_control_exec.py +++ b/plugins/modules/sap_control_exec.py @@ -267,6 +267,7 @@ HAS_SUDS_LIBRARY = False SUDS_LIBRARY_IMPORT_ERROR = traceback.format_exc() else: + SUDS_LIBRARY_IMPORT_ERROR = None HAS_SUDS_LIBRARY = True diff --git a/plugins/modules/sap_pyrfc.py b/plugins/modules/sap_pyrfc.py index 78156e8..51dbcea 100644 --- a/plugins/modules/sap_pyrfc.py +++ b/plugins/modules/sap_pyrfc.py @@ -118,6 +118,7 @@ HAS_PYRFC_LIBRARY = False PYRFC_LIBRARY_IMPORT_ERROR = traceback.format_exc() else: + PYRFC_LIBRARY_IMPORT_ERROR = None HAS_PYRFC_LIBRARY = True @@ -162,6 +163,7 @@ def main(): try: conn = get_connection(module, conn_params) result = conn.call(function, **func_params) + error_msg = None except CommunicationError as err: msg = "Could not connect to server" error_msg = err.message diff --git a/plugins/modules/sap_snote.py b/plugins/modules/sap_snote.py index 3e3f930..b97e9a2 100644 --- a/plugins/modules/sap_snote.py +++ b/plugins/modules/sap_snote.py @@ -147,6 +147,7 @@ HAS_PYRFC_LIBRARY = False ANOTHER_LIBRARY_IMPORT_ERROR = traceback.format_exc() else: + ANOTHER_LIBRARY_IMPORT_ERROR = None HAS_PYRFC_LIBRARY = True diff --git a/plugins/modules/sap_task_list_execute.py b/plugins/modules/sap_task_list_execute.py index c9a47ba..f46a5d6 100644 --- a/plugins/modules/sap_task_list_execute.py +++ b/plugins/modules/sap_task_list_execute.py @@ -193,6 +193,7 @@ HAS_PYRFC_LIBRARY = False PYRFC_LIBRARY_IMPORT_ERROR = traceback.format_exc() else: + PYRFC_LIBRARY_IMPORT_ERROR = None HAS_PYRFC_LIBRARY = True try: import xmltodict @@ -200,6 +201,7 @@ HAS_XMLTODICT_LIBRARY = False XMLTODICT_LIBRARY_IMPORT_ERROR = traceback.format_exc() else: + XMLTODICT_LIBRARY_IMPORT_ERROR = None HAS_XMLTODICT_LIBRARY = True diff --git a/plugins/modules/sap_user.py b/plugins/modules/sap_user.py index c0b7bb2..93d465b 100644 --- a/plugins/modules/sap_user.py +++ b/plugins/modules/sap_user.py @@ -246,6 +246,7 @@ HAS_PYRFC_LIBRARY = False PYRFC_LIBRARY_IMPORT_ERROR = traceback.format_exc() else: + PYRFC_LIBRARY_IMPORT_ERROR = None HAS_PYRFC_LIBRARY = True diff --git a/tests/sanity/ignore-2.14.txt b/tests/sanity/ignore-2.14.txt new file mode 100644 index 0000000..3883757 --- /dev/null +++ b/tests/sanity/ignore-2.14.txt @@ -0,0 +1,9 @@ +plugins/modules/sap_pyrfc.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0 +plugins/modules/sap_company.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0 +plugins/modules/sap_control_exec.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0 +plugins/modules/sap_hdbsql.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0 +plugins/modules/sap_snote.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0 +plugins/modules/sap_system_facts.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0 +plugins/modules/sap_task_list_execute.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0 +plugins/modules/sap_user.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0 +plugins/modules/sapcar_extract.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0 \ No newline at end of file diff --git a/tests/sanity/ignore-2.15.txt b/tests/sanity/ignore-2.15.txt new file mode 100644 index 0000000..3883757 --- /dev/null +++ b/tests/sanity/ignore-2.15.txt @@ -0,0 +1,9 @@ +plugins/modules/sap_pyrfc.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0 +plugins/modules/sap_company.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0 +plugins/modules/sap_control_exec.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0 +plugins/modules/sap_hdbsql.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0 +plugins/modules/sap_snote.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0 +plugins/modules/sap_system_facts.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0 +plugins/modules/sap_task_list_execute.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0 +plugins/modules/sap_user.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0 +plugins/modules/sapcar_extract.py validate-modules:missing-gplv3-license # Licensed under Apache 2.0 \ No newline at end of file From 10088cda266d869f34c065b7dbac8a18f38fb15d Mon Sep 17 00:00:00 2001 From: Rainer Leber <39616583+rainerleber@users.noreply.github.com> Date: Mon, 5 Dec 2022 10:34:50 +0000 Subject: [PATCH 4/5] Release 1.4.0 commit --- README.md | 3 +++ changelogs/fragments/1.4.0.yml | 4 ++++ galaxy.yml | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/1.4.0.yml diff --git a/README.md b/README.md index d3a06a2..61a8955 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,7 @@ Tested Ansible versions: - 2.11 - 2.12 - 2.13 +- 2.14 - devel Tested Python versions: @@ -80,6 +81,8 @@ Tested Python versions: - 3.7 - 3.8 - 3.9 +- 3.10 +- 3.11 Due to SAP licensing and hardware requirements, integration tests are momentarily not feasible. The modules are tested manually against SAP systems until we found a solution or have some diff --git a/changelogs/fragments/1.4.0.yml b/changelogs/fragments/1.4.0.yml new file mode 100644 index 0000000..008d023 --- /dev/null +++ b/changelogs/fragments/1.4.0.yml @@ -0,0 +1,4 @@ +release_summary: |- + This is the 1.3.0 minor release of the ``community.sap_libs`` collection. + This changelog contains all changes to the modules and plugins in this collection + that have been made after the previous release. \ No newline at end of file diff --git a/galaxy.yml b/galaxy.yml index 08f9018..f0ce8a5 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -2,7 +2,7 @@ namespace: community name: sap_libs -version: 1.3.0 +version: 1.4.0 readme: README.md authors: - Rainer Leber (github.com/rainerleber) From bf552fe88f5f4fc0005e710b00a44b53bcca5d0d Mon Sep 17 00:00:00 2001 From: Rainer Leber <39616583+rainerleber@users.noreply.github.com> Date: Mon, 5 Dec 2022 10:38:42 +0000 Subject: [PATCH 5/5] changelog for 1.4.0 --- CHANGELOG.rst | 16 +++++++++++++- changelogs/changelog.yaml | 22 ++++++++++++++++--- .../fragments/0020-fix_sap_control_exec.yml | 2 -- changelogs/fragments/1.4.0.yml | 4 ---- .../fragments/22-use-before-assignment.yml | 3 --- 5 files changed, 34 insertions(+), 13 deletions(-) delete mode 100644 changelogs/fragments/0020-fix_sap_control_exec.yml delete mode 100644 changelogs/fragments/1.4.0.yml delete mode 100644 changelogs/fragments/22-use-before-assignment.yml diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 007d1fb..0a7cecd 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,7 +5,7 @@ Community SAP Release Notes .. contents:: Topics -v1.3.0 +v1.4.0 ====== Release Summary @@ -15,6 +15,20 @@ This is the 1.3.0 minor release of the ``community.sap_libs`` collection. This changelog contains all changes to the modules and plugins in this collection that have been made after the previous release. +Bugfixes +-------- + +- fix a bug where some commands produces no output which cause to crash the module. +- modules - fix a "variable used before assignment" that cannot be reached but causes sanity test failures. + +v1.3.0 +====== + +Release Summary +--------------- + +This is the 1.3.0 minor release of the ``community.sap_libs`` collection. This changelog contains all changes to the modules and plugins in this collection that have been made after the previous release. + Minor Changes ------------- diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 56683e4..d0b7bf4 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -64,7 +64,6 @@ releases: release_date: '2022-07-18' 1.3.0: changes: - breaking_changes: minor_changes: - License requirements are updated. - The modules purposes are described clearer. @@ -72,10 +71,27 @@ releases: - hana_query - module is moved to sap_hdbsql. - sapcontrol - module is moved to sap_control_exec to have a clearer separation to other roles and references. + release_summary: This is the 1.3.0 minor release of the ``community.sap_libs`` + collection. This changelog contains all changes to the modules and plugins + in this collection that have been made after the previous release. + fragments: + - 1.3.0.yml + release_date: '2022-09-09' + 1.4.0: + changes: + bugfixes: + - fix a bug where some commands produces no output which cause to crash the + module. + - modules - fix a "variable used before assignment" that cannot be reached but + causes sanity test failures. release_summary: 'This is the 1.3.0 minor release of the ``community.sap_libs`` collection. + This changelog contains all changes to the modules and plugins in this collection + that have been made after the previous release.' fragments: - - 1.3.0.yml - release_date: '2022-09-09' + - 0020-fix_sap_control_exec.yml + - 1.4.0.yml + - 22-use-before-assignment.yml + release_date: '2022-12-05' diff --git a/changelogs/fragments/0020-fix_sap_control_exec.yml b/changelogs/fragments/0020-fix_sap_control_exec.yml deleted file mode 100644 index 9808d03..0000000 --- a/changelogs/fragments/0020-fix_sap_control_exec.yml +++ /dev/null @@ -1,2 +0,0 @@ -bugfixes: - - fix a bug where some commands produces no output which cause to crash the module. \ No newline at end of file diff --git a/changelogs/fragments/1.4.0.yml b/changelogs/fragments/1.4.0.yml deleted file mode 100644 index 008d023..0000000 --- a/changelogs/fragments/1.4.0.yml +++ /dev/null @@ -1,4 +0,0 @@ -release_summary: |- - This is the 1.3.0 minor release of the ``community.sap_libs`` collection. - This changelog contains all changes to the modules and plugins in this collection - that have been made after the previous release. \ No newline at end of file diff --git a/changelogs/fragments/22-use-before-assignment.yml b/changelogs/fragments/22-use-before-assignment.yml deleted file mode 100644 index 044a7e1..0000000 --- a/changelogs/fragments/22-use-before-assignment.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -bugfixes: - - modules - fix a "variable used before assignment" that cannot be reached but causes sanity test failures. \ No newline at end of file