Skip to content

Commit

Permalink
Merge branch 'main' into fix_nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwini-mhatre authored Feb 14, 2024
2 parents 47de15b + 2933ef2 commit 18e61e8
Show file tree
Hide file tree
Showing 17 changed files with 119 additions and 85 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/ack.yml → .github/workflows/check_label.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion .github/workflows/codecoverage.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: code_coverage
name: "Code converage"

on: # yamllint disable-line rule:truthy
push:
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/draft_release.yml
Original file line number Diff line number Diff line change
@@ -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 }}
13 changes: 0 additions & 13 deletions .github/workflows/lint.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/push.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
21 changes: 12 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: CI
name: "CI"

concurrency:
group: ${{ github.head_ref || github.run_id }}
Expand All @@ -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: >-
Expand All @@ -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 }}'
])"
4 changes: 2 additions & 2 deletions .github/workflows/token_refresh.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
name: refresh_automation_hub_token
name: "Refresh Automation Hub Token"
on: # yamllint disable-line rule:truthy
schedule:
- cron: '0 0 * * *'
workflow_dispatch:

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:
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
======

Expand Down
17 changes: 17 additions & 0 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
3 changes: 0 additions & 3 deletions changelogs/fragments/Fre_fact_diff.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions changelogs/fragments/add_require_Connection.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions changelogs/fragments/ipv6form-doc.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions changelogs/fragments/validate-doc.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ tags:
- data
- validation
- utils
version: 3.0.0
version: 3.1.0
44 changes: 34 additions & 10 deletions tests/unit/plugins/filter/test_ipaddr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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([]), [])
Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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",
):
Expand Down
9 changes: 9 additions & 0 deletions tox-ansible.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[ansible]
skip =
py3.7
py3.8
2.9
2.10
2.11
2.12
2.13

0 comments on commit 18e61e8

Please sign in to comment.