diff --git a/.github/workflows/ack.yml b/.github/workflows/check_label.yml similarity index 60% rename from .github/workflows/ack.yml rename to .github/workflows/check_label.yml index fda595dc..b120bfa3 100644 --- a/.github/workflows/ack.yml +++ b/.github/workflows/check_label.yml @@ -1,15 +1,11 @@ --- -# See https://github.com/ansible-community/devtools/blob/main/.github/workflows/ack.yml -name: ack - +name: "Check label" concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true - on: # yamllint disable-line rule:truthy pull_request_target: types: [opened, labeled, unlabeled, synchronize] - jobs: - ack: - uses: ansible/devtools/.github/workflows/ack.yml@main + check_label: + uses: ansible/ansible-content-actions/.github/workflows/check_label.yaml@main diff --git a/.github/workflows/codecoverage.yml b/.github/workflows/codecoverage.yml index c2a7ad60..7ae6b632 100644 --- a/.github/workflows/codecoverage.yml +++ b/.github/workflows/codecoverage.yml @@ -1,5 +1,5 @@ --- -name: code_coverage +name: "Code converage" on: # yamllint disable-line rule:truthy push: diff --git a/.github/workflows/draft_release.yml b/.github/workflows/draft_release.yml new file mode 100644 index 00000000..640bf2d1 --- /dev/null +++ b/.github/workflows/draft_release.yml @@ -0,0 +1,18 @@ +--- +name: "Draft release" +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true +on: # yamllint disable-line rule:truthy + workflow_dispatch: +env: + NAMESPACE: ${{ github.repository_owner }} + COLLECTION_NAME: utils + ANSIBLE_COLLECTIONS_PATHS: ./ +jobs: + update_release_draft: + uses: ansible/ansible-content-actions/.github/workflows/draft_release.yaml@main + with: + repo: ${{ github.event.pull_request.head.repo.full_name }} + secrets: + BOT_PAT: ${{ secrets.BOT_PAT }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 4e45c595..00000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -name: ansible-lint -on: # yamllint disable-line rule:truthy - pull_request: - branches: ["main"] -jobs: - build: - name: Ansible Lint # Naming the build is important to use it as a status check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Run ansible-lint - uses: ansible/ansible-lint@main # or version tag instead of 'main' diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml deleted file mode 100644 index de66d053..00000000 --- a/.github/workflows/push.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -# push workflow is shared and expected to perform actions after a merge happens -# on a maintenance branch (default or release). For example updating the -# draft release-notes. -# based on great work from -# https://github.com/T-Systems-MMS/ansible-collection-icinga-director -name: push - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - - -on: - workflow_dispatch: - -env: - NAMESPACE: ansible - COLLECTION_NAME: utils - ANSIBLE_COLLECTIONS_PATHS: ./ - -jobs: - update_release_draft: - uses: ansible/devtools/.github/workflows/push_network.yml@main - with: - repo: ansible-collections/ansible.utils - secrets: - BOT_PAT: ${{ secrets.BOT_PAT }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eb04259d..6dbb1aa3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,12 +1,12 @@ --- -name: release +name: "Release collection" on: # yamllint disable-line rule:truthy release: types: [published] jobs: release: - uses: ansible/devtools/.github/workflows/release_collection.yml@main + uses: ansible/ansible-content-actions/.github/workflows/release.yaml@main with: environment: release secrets: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b0a17350..6f075eb1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,5 +1,5 @@ --- -name: CI +name: "CI" concurrency: group: ${{ github.head_ref || github.run_id }} @@ -14,22 +14,24 @@ on: # yamllint disable-line rule:truthy jobs: changelog: - uses: ansible-network/github_actions/.github/workflows/changelog.yml@main + uses: ansible/ansible-content-actions/.github/workflows/changelog.yaml@main if: github.event_name == 'pull_request' - integration: - uses: ansible-network/github_actions/.github/workflows/integration_simple.yml@main + ansible-lint: + uses: ansible/ansible-content-actions/.github/workflows/ansible_lint.yaml@main sanity: - uses: ansible-network/github_actions/.github/workflows/sanity.yml@main + uses: ansible/ansible-content-actions/.github/workflows/sanity.yaml@main unit-galaxy: - uses: ansible-network/github_actions/.github/workflows/unit_galaxy.yml@main - + uses: ansible/ansible-content-actions/.github/workflows/unit.yaml@main + integration: + uses: ansible/ansible-content-actions/.github/workflows/integration.yaml@main all_green: if: ${{ always() }} needs: - changelog - - integration - sanity - unit-galaxy + - ansible-lint + - integration runs-on: ubuntu-latest steps: - run: >- @@ -38,5 +40,6 @@ jobs: '${{ needs.changelog.result }}', '${{ needs.integration.result }}', '${{ needs.sanity.result }}', - '${{ needs.unit-galaxy.result }}' + '${{ needs.unit-galaxy.result }}', + '${{ needs.ansible-lint.result }}' ])" diff --git a/.github/workflows/token_refresh.yml b/.github/workflows/token_refresh.yml index 3fd76b1c..d0a71c0f 100644 --- a/.github/workflows/token_refresh.yml +++ b/.github/workflows/token_refresh.yml @@ -1,5 +1,5 @@ --- -name: refresh_automation_hub_token +name: "Refresh Automation Hub Token" on: # yamllint disable-line rule:truthy schedule: - cron: '0 0 * * *' @@ -7,7 +7,7 @@ on: # yamllint disable-line rule:truthy jobs: refresh: - uses: ansible/devtools/.github/workflows/ah_token_refresh.yml@main + uses: ansible/ansible-content-actions/.github/workflows/refresh_ah_token.yaml@main with: environment: release secrets: diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d92380c1..077f7e38 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,26 @@ Ansible Utils Collection Release Notes .. contents:: Topics +v3.1.0 +====== + +Minor Changes +------------- + +- Add support in fact_diff filter plugin to show common lines.(https://github.com/ansible-collections/ansible.utils/issues/311) + +Bugfixes +-------- + +- Avoid unnecessary use of persistent connection in `cli_parse`, `fact_diff`, `update_fact` and `validate` as this action does not require a connection. + +Documentation Changes +--------------------- + +- ipv6form filter plugin - Fix to be displayed correctly. +- validate lookup plugin - Fix syntax in EXAMPLES. +- validate module - Fix syntax in EXAMPLES. + v3.0.0 ====== diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 9e7e8320..39e50672 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -390,3 +390,20 @@ releases: fragments: - update_requires_ansible.yaml release_date: "2023-11-30" + 3.1.0: + changes: + bugfixes: + - Avoid unnecessary use of persistent connection in `cli_parse`, `fact_diff`, + `update_fact` and `validate` as this action does not require a connection. + doc_changes: + - ipv6form filter plugin - Fix to be displayed correctly. + - validate lookup plugin - Fix syntax in EXAMPLES. + - validate module - Fix syntax in EXAMPLES. + minor_changes: + - Add support in fact_diff filter plugin to show common lines.(https://github.com/ansible-collections/ansible.utils/issues/311) + fragments: + - Fre_fact_diff.yaml + - add_require_Connection.yaml + - ipv6form-doc.yaml + - validate-doc.yaml + release_date: "2024-01-30" diff --git a/changelogs/fragments/Fre_fact_diff.yaml b/changelogs/fragments/Fre_fact_diff.yaml deleted file mode 100644 index dfa49f71..00000000 --- a/changelogs/fragments/Fre_fact_diff.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -minor_changes: - - Add support in fact_diff filter plugin to show common lines.(https://github.com/ansible-collections/ansible.utils/issues/311) diff --git a/changelogs/fragments/add_require_Connection.yaml b/changelogs/fragments/add_require_Connection.yaml deleted file mode 100644 index 656b8d15..00000000 --- a/changelogs/fragments/add_require_Connection.yaml +++ /dev/null @@ -1,2 +0,0 @@ -bugfixes: - - Avoid unnecessary use of persistent connection in `cli_parse`, `fact_diff`, `update_fact` and `validate` as this action does not require a connection. diff --git a/changelogs/fragments/ipv6form-doc.yaml b/changelogs/fragments/ipv6form-doc.yaml deleted file mode 100644 index ca660547..00000000 --- a/changelogs/fragments/ipv6form-doc.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -doc_changes: - - ipv6form filter plugin - Fix to be displayed correctly. diff --git a/changelogs/fragments/validate-doc.yaml b/changelogs/fragments/validate-doc.yaml deleted file mode 100644 index cb8fd4cd..00000000 --- a/changelogs/fragments/validate-doc.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- -doc_changes: - - validate lookup plugin - Fix syntax in EXAMPLES. - - validate module - Fix syntax in EXAMPLES. diff --git a/galaxy.yml b/galaxy.yml index f4b62077..a1f2480f 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -19,4 +19,4 @@ tags: - data - validation - utils -version: 3.0.0 +version: 3.1.0 diff --git a/tests/unit/plugins/filter/test_ipaddr.py b/tests/unit/plugins/filter/test_ipaddr.py index afdf1943..0193967b 100644 --- a/tests/unit/plugins/filter/test_ipaddr.py +++ b/tests/unit/plugins/filter/test_ipaddr.py @@ -38,10 +38,16 @@ class TestIpFilter(unittest.TestCase): def test_cidr_merge(self): - with pytest.raises(AnsibleFilterError, match="cidr_merge: expected iterable, got None"): + with pytest.raises( + AnsibleFilterError, + match="cidr_merge: expected iterable, got None", + ): cidr_merge(None) - with pytest.raises(AnsibleFilterError, match="cidr_merge: invalid action 'floop'"): + with pytest.raises( + AnsibleFilterError, + match="cidr_merge: invalid action 'floop'", + ): cidr_merge([], "floop") self.assertEqual(cidr_merge([]), []) @@ -389,15 +395,30 @@ def test_network_netmask(self): address = "1.12.1.0/25" self.assertEqual(ipaddr(address, "network_netmask"), "1.12.1.0 255.255.255.128") address = "1.12.1.36/28" - self.assertEqual(ipaddr(address, "network_netmask"), "1.12.1.32 255.255.255.240") + self.assertEqual( + ipaddr(address, "network_netmask"), + "1.12.1.32 255.255.255.240", + ) address = "1.12.1.36/255.255.255.240" - self.assertEqual(ipaddr(address, "network_netmask"), "1.12.1.32 255.255.255.240") + self.assertEqual( + ipaddr(address, "network_netmask"), + "1.12.1.32 255.255.255.240", + ) address = "1.12.1.36/31" - self.assertEqual(ipaddr(address, "network_netmask"), "1.12.1.36 255.255.255.254") + self.assertEqual( + ipaddr(address, "network_netmask"), + "1.12.1.36 255.255.255.254", + ) address = "1.12.1.37/31" - self.assertEqual(ipaddr(address, "network_netmask"), "1.12.1.36 255.255.255.254") + self.assertEqual( + ipaddr(address, "network_netmask"), + "1.12.1.36 255.255.255.254", + ) address = "1.12.1.36/32" - self.assertEqual(ipaddr(address, "network_netmask"), "1.12.1.36 255.255.255.255") + self.assertEqual( + ipaddr(address, "network_netmask"), + "1.12.1.36 255.255.255.255", + ) address = "1.12.1.254/24" self.assertEqual(ipaddr(address, "network_netmask"), "1.12.1.0 255.255.255.0") @@ -493,7 +514,10 @@ def test_ipmath(self): self.assertEqual(ipmath("2001::1", 9), "2001::a") self.assertEqual(ipmath("2001::1", 10), "2001::b") self.assertEqual(ipmath("2001::5", -3), "2001::2") - self.assertEqual(ipmath("2001::5", -10), "2000:ffff:ffff:ffff:ffff:ffff:ffff:fffb") + self.assertEqual( + ipmath("2001::5", -10), + "2000:ffff:ffff:ffff:ffff:ffff:ffff:fffb", + ) expected = "You must pass a valid IP address; invalid_ip is invalid" with self.assertRaises(AnsibleFilterError) as exc: @@ -544,13 +568,13 @@ def _test_ipsubnet(self, ipsubnet_args, expected_result): ipsubnet("1.1.1.1/25", "24") self.assertEqual(exc.exception.message, expected) - with self.assertRaisesRegexp( + with self.assertRaisesRegex( AnsibleFilterError, "You must pass a valid subnet or IP address; invalid_subnet is invalid", ): ipsubnet("192.168.144.5", "invalid_subnet") - with self.assertRaisesRegexp( + with self.assertRaisesRegex( AnsibleFilterError, "192.168.144.0/30 is not in the subnet 192.168.144.4/30", ): diff --git a/tox-ansible.ini b/tox-ansible.ini index e69de29b..fe560ad9 100644 --- a/tox-ansible.ini +++ b/tox-ansible.ini @@ -0,0 +1,9 @@ +[ansible] +skip = + py3.7 + py3.8 + 2.9 + 2.10 + 2.11 + 2.12 + 2.13