Commit Graph

78 Commits (main)

Author SHA1 Message Date
Ruchi Pakhle 256e787967
Added netaddr as a requirement in ansible.utils.ipaddr (#385)
* Added requirement on netaddr

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Added changelog

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* minor changes

* Added requirement on netaddr to ansible.utils.ipaddr

* changes

* minor change

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Benoît Geeraerts <10222438+b-enoit-be@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-01-07 16:17:53 +05:30
Ruchi Pakhle e594aa6090
fix the pylint used-before-assignment error (#367)
* fix the pylint used-before-assignment error

* fix integration tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-08-20 20:19:57 +05:30
Andrew J Roth 038bcb163e
fixed ipcut to support ipv4 (#358)
* fixed ipcut to support ipv4

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add changelog

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ruchi Pakhle <72685035+Ruchip16@users.noreply.github.com>
Co-authored-by: Ruchi Pakhle <ruchipakhle@gmail.com>
2024-08-02 16:09:34 +05:30
Giorgi Zeikidze 6425ea2299
add wildcard mask/hostmask to ipaddr filter doc page (#324)
* add wildcard mask/hostmask to ipaddr filter doc page

This might seem like an unnecessary addition but wildcard filter not being here has cost me couple of hours and a failed exam. I tried to follow convention as much as I could

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add changelog and add a note in readme

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add a note in readme check

* update readme

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* correct the link

* correct the link

* correct the link

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update changelogs/fragments/324.yaml

Co-authored-by: Sagar Paul <sagpaul@redhat.com>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Sagar Paul <sagpaul@redhat.com>
Co-authored-by: Ruchi Pakhle <72685035+Ruchip16@users.noreply.github.com>
Co-authored-by: Nilashish Chakraborty <nilashishchakraborty8@gmail.com>
Co-authored-by: Ruchi Pakhle <ruchipakhle@gmail.com>
2024-07-19 20:13:24 +05:30
Ashwini Mhatre 92903a3a58
Enhance fact_diff to show common lines (#323)
* Enhance fact_diff to show common lines

* Add integration and unit tests

* Fix sanity

---------

Co-authored-by: Ashwini Mhatre <amhatre@amhatre-thinkpadt14sgen2i.pnq.csb>
2024-01-16 17:55:39 +05:30
Akira Yokochi 6842746a9d
docs: Fixed ipv6form filter document (#320)
* fix ipv6form doc

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add changelog fragment

* rename

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ashwini Mhatre <mashu97@gmail.com>
2024-01-04 14:57:55 +05:30
Ashwini Mhatre 4f07a4afca
fact_diff filter plugin (#310)
* Add fact_diff filter plugin

* Add integration and unit tests

* Add changelog

* Add argspect test

* Add examples

* Fix lint

* Fix ansible-lint

* REvert changes

* Fix sanity

* Address review comments

* Delete tests/integration/inventory

---------

Co-authored-by: Ashwini Mhatre <amhatre@amhatre-thinkpadt14sgen2i.pnq.csb>
2023-11-13 11:28:43 +05:30
Ashwini Mhatre 4deddf2c3b
Feature ipv6 format (#295)
* Create ipv6form.py

* Update ipv6form.py

* Update ipv6form.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add code

* Add docs

* Add uts and integration tests. fix sanity

* iFix sanity

* Fix sanity

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ashwini Mhatre <amhatre@amhatre-thinkpadt14sgen2i.pnq.csb>
2023-08-10 13:40:17 +05:30
Ashwini Mhatre ce5e10c004
Add ipcut filter plugin (#291)
* Add ipcut filter plugin

* Add testcases

* Add testcases

* Fix sanity

* Fix sanity

* Fix sanity

* Fix ansible-lint

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update ipcut.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix sanity

* Fix sanity

* iFix sanity

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ashwini Mhatre <amhatre@amhatre-thinkpadt14sgen2i.pnq.csb>
2023-08-07 16:19:33 +05:30
Ashwini Mhatre 827e88dfbf
Bugfix ip4 hex (#292)
* Fix bug in ipv4_hex filter.

* Fix issue in ipv4_hex

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update tests/integration/targets/utils_ipaddr_filter/tasks/ip4_hex.yaml

Co-authored-by: Sagar Paul <sagpaul@redhat.com>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Sagar Paul <sagpaul@redhat.com>
2023-07-20 11:46:34 +05:30
pre-commit-ci[bot] 1c31436512
[pre-commit.ci] pre-commit autoupdate (#290)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/asottile/add-trailing-comma: v2.5.1 → v3.0.0](https://github.com/asottile/add-trailing-comma/compare/v2.5.1...v3.0.0)
- [github.com/pre-commit/mirrors-prettier: v3.0.0-alpha.9-for-vscode → v3.0.0](https://github.com/pre-commit/mirrors-prettier/compare/v3.0.0-alpha.9-for-vscode...v3.0.0)
- [github.com/psf/black: 23.3.0 → 23.7.0](https://github.com/psf/black/compare/23.3.0...23.7.0)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-07-19 09:29:35 -04:00
Kate Case 9668f26a26
Update pre-commit config (#245)
* Update pre-commit config
2023-03-29 18:18:57 -04:00
Ashwini Mhatre fca1229097
Added support to disable xml declartion with full_document flag (#237) 2022-12-28 19:47:34 +05:30
Kate Case 24e53efe5e
Add documentation for IPv6 in ipsubnet filter (#212)
* fix typo. Add example for IPV6

* add unit tests for IPv6

Co-authored-by: serosset <serosset@cisco.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-12-05 16:00:19 -05:00
Ashwini Mhatre baba9ca7ea
Accept int input for ipaddr ipv4 and ipv6 filters (#224)
* Accept int input for ipaddr ipv4 and ipv6 filters

* Fix fragment

* Fix tests
2022-11-21 15:18:35 +05:30
Federico Chiacchiaretta 0aee02eb97
Welcome to support for indentation with spaces in to_xml plugin (#192)
* Welcome to support for indentation with spaces in to_xml plugin

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Changelog fragment

* Unit tests for:

* Indent with spaces and explicit indent_width (4)
* Invalid indent

I also slightly modified VALID_DATA to produce output with indentation,
so existing test_valid_data and OUTPUT has been updated accordingly.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix changelog section name to minor_changes

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-04 14:13:13 -04:00
Felix Fontein b73ed61a47
Fix filter and test docs (#215)
* Fix filter and test documentation syntax errors.

Most cases were strings that were YAML-parsable as dictionaries due to colons,
sometimes of the form `str: str`, and sometimes of the form `str: list`.

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-14 13:02:22 -04:00
artraf 61665ea45a
Fix not optimal variable assignment (#207) 2022-10-14 15:35:33 +00:00
Harm Geerts e3e4f7595d
Fix #209 ansible.utils filters should raise AnsibleFilterError (#210)
* Fix #209 ansible.utils filters should raise AnsibleFilterError

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-14 10:55:05 -04:00
Kate Case 462e4e7f71
Clean up test failures (#216)
* Fix arguments-renamed

* Handle changed behavior in 2.15
2022-10-13 11:01:42 -04:00
Tim Way 57c5cd4336
Switch To Calculating Networking Information Directly For Performance (#146)
* Add Unit Tests To Capture Failures From 'subnet' Generator

The netaddr library returns a generator for the 'subnet' call. This works great until you use larger networks. While it is uncommon to encounter it in IPv4 usage it is trivial to hit it in IPv6.

* Switch To Calculating Networking Information Directly For Performance

This replaces the inefficient generator for 'subnet' and uses math to determine the result directly. Since a list is not returned directly to the client in the implemented cases this works great and is fast.

A further optimization at least on the logic of this might be to break the different cases implemented by the filter out into unique functions. I did not do this yet because I wanted to get feedback on this direction.

* Changelog Fragment For PR / Bugfix

Adding changelog fragment that references source issue.

* Dropping Python 3.7 Bypass Removes Need For 'sys' Module

A test for ipsubnet was bypassed under 3.7 because of an inconsistent return value w/3.6 and 2.7. I removed the bypass and changed the behavior of the filter to raise an AnsibleFilterError in all versions of Python.

* Add A Pair of Integration Tests

These demonstrate the issue with the current implementation and would normally stall out while building the list of possible subnets from the generator.

* Address Changelog Feedback

I kept the performance item as a bugfix but bumped the typing to a minor change.

* Add 'netaddr' To Integration Test 'requirements.txt'

* The `ansible-test integration --docker` requires this line in requirements.txt to pass the 'netaddr' related tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Replace str -> to_text

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kate Case <this.is@katherineca.se>
2022-08-31 12:09:35 -04:00
Bradley A. Thornton a0622d06ce
Add trailing comma support to pre-commit (#190) 2022-06-01 18:05:10 +05:30
Bradley A. Thornton 2541cb3f6a
Add isort, increase black line length (#189) 2022-05-26 13:18:57 -04:00
KB-perByte 6110081f19
sanity fix 2022-04-11 17:20:49 +05:30
KB-perByte ca31a4e474
update docs 2022-04-11 16:13:46 +05:30
KB-perByte 1ce17fab54
update tests 2022-04-09 11:28:35 +05:30
KB-perByte 595c9ee38f
review pt 1 2022-04-08 23:31:45 +05:30
KB-perByte 89efc29ab4
update added version 2022-04-06 19:25:56 +05:30
KB-perByte f3e851d544
update review 1 2022-04-06 19:19:48 +05:30
KB-perByte 3f98e8ae7a
sanity and tox fixed 2022-04-05 15:44:37 +05:30
KB-perByte 02779ae85a
UTs added 2022-04-05 12:23:31 +05:30
KB-perByte 38986edc8e
doc fix 2022-04-04 21:09:45 +05:30
KB-perByte 1b34ebd896
tox fixed and docstrings 2022-04-04 21:06:58 +05:30
KB-perByte 0cbb257293
update 1 2022-04-04 20:56:07 +05:30
KB-perByte f337f82d59
docs and examples 2022-04-04 20:02:43 +05:30
KB-perByte 141c175cff
sanity fixex updated 2022-04-04 17:58:09 +05:30
KB-perByte 66bd592df4
init code 2022-04-04 17:55:01 +05:30
Ashwini Mhatre 0716010fe3
Fix bugs in Ipaddr filters (#149)
Fix bugs in Ipaddr filters

SUMMARY

ipaddr - Fix input validation issues in ipaddr,ipv4,ipv6,ipwrap filters.
ipaddr - Add valid network for link-local
fixes: #148
fixes: ansible-collections/ansible.netcommon#375
fixes: ansible-collections/ansible.netcommon#350

ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Nilashish Chakraborty <nilashishchakraborty8@gmail.com>
Reviewed-by: Sagar Paul <sagpaul@redhat.com>
2022-03-04 11:43:59 +00:00
Sagar Paul 9294a2df8f
doc fixes (#134)
Minor documentation fixes

SUMMARY

Minor documentation fixes and updated doc-string

ISSUE TYPE


Docs Pull Request

Reviewed-by: Ashwini Mhatre <mashu97@gmail.com>
Reviewed-by: None <None>
2022-01-31 10:30:34 +00:00
Sagar Paul 624bc76e26
Recursive filter plugins remove_keys | replace_keys | keep_keys (#110)
Recursive filter plugins remove_keys | replace_keys | keep_keys

SUMMARY

New plugins

remove_keys
replace_keys
keep_keys


ISSUE TYPE


New Module Pull Request

COMPONENT NAME


remove_keys
replace_keys
keep_keys

ADDITIONAL INFORMATION

Reviewed-by: Ashwini Mhatre <mashu97@gmail.com>
Reviewed-by: Nilashish Chakraborty <nilashishchakraborty8@gmail.com>
Reviewed-by: None <None>
2022-01-27 06:52:38 +00:00
Ashwini Mhatre ea54e97359
Add hwaddr, macaddr, slaac filter plugin (#129)
Add hwaddr, macaddr, slaac filter plugin

SUMMARY

Added hwaddr, macaddr, slaac filter plugin

ISSUE TYPE

New Module Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Nathaniel Case <this.is@nathanielca.se>
Reviewed-by: Ashwini Mhatre <mashu97@gmail.com>
Reviewed-by: Sagar Paul <sagpaul@redhat.com>
Reviewed-by: None <None>
2022-01-24 21:43:18 +00:00
Ashwini Mhatre 4488b79b04
Add ipaddr Filter plugin (#115)
Add ipaddr Filter plugin

SUMMARY

depend-on: #113

ISSUE TYPE


New Module Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Nathaniel Case <this.is@nathanielca.se>
Reviewed-by: Ashwini Mhatre <mashu97@gmail.com>
Reviewed-by: Sagar Paul <sagpaul@redhat.com>
Reviewed-by: None <None>
2022-01-24 11:15:16 +00:00
Ashwini Mhatre cfc7965400
Add ipwrap filter plugin (#118)
Add ipwrap filter plugin

SUMMARY


ISSUE TYPE


New Module Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Priyam Sahoo <None>
Reviewed-by: Sagar Paul <sagpaul@redhat.com>
Reviewed-by: None <None>
2022-01-22 11:27:27 +00:00
Ashwini Mhatre 2aa677777e
Add network_in_usable filter plugin (#126)
Add network_in_usable filter plugin

SUMMARY


ISSUE TYPE


New Module Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Nathaniel Case <this.is@nathanielca.se>
Reviewed-by: Nilashish Chakraborty <nilashishchakraborty8@gmail.com>
Reviewed-by: None <None>
Reviewed-by: Priyam Sahoo <None>
2022-01-21 20:12:17 +00:00
Ashwini Mhatre 3cb7ea10ca
Add previous_nth_usable filter plugin (#124)
Add previous_nth_usable filter plugin

SUMMARY


ISSUE TYPE


New Module Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Nathaniel Case <this.is@nathanielca.se>
Reviewed-by: Nilashish Chakraborty <nilashishchakraborty8@gmail.com>
Reviewed-by: None <None>
2022-01-21 18:04:36 +00:00
Ashwini Mhatre 315200166f
Add plugin Reduce_on_network (#127)
Add plugin Reduce_on_network

SUMMARY


ISSUE TYPE


New Module Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Nathaniel Case <this.is@nathanielca.se>
Reviewed-by: Nilashish Chakraborty <nilashishchakraborty8@gmail.com>
Reviewed-by: None <None>
2022-01-21 10:34:01 +00:00
Ashwini Mhatre 234b0a51cf
Add network_in_network filter plugin (#125)
Add network_in_network filter plugin

SUMMARY


ISSUE TYPE


New Module Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Nathaniel Case <this.is@nathanielca.se>
Reviewed-by: Nilashish Chakraborty <nilashishchakraborty8@gmail.com>
Reviewed-by: None <None>
2022-01-20 19:31:40 +00:00
Ashwini Mhatre 1d697455b6
Add next nth usable filter plugin (#123)
Add next nth usable filter plugin

SUMMARY


ISSUE TYPE


New Module Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Rohit Thakur <rohitthakur2590@outlook.com>
Reviewed-by: None <None>
Reviewed-by: Nathaniel Case <this.is@nathanielca.se>
2022-01-20 17:30:14 +00:00
Ashwini Mhatre 80b7015fe8
Add ipsubnet filter plugin (#122)
Add ipsubnet filter plugin

SUMMARY


ISSUE TYPE


New Module Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Nathaniel Case <this.is@nathanielca.se>
Reviewed-by: None <None>
2022-01-20 15:03:54 +00:00
Ashwini Mhatre c04c648b7a
Add IPV6 filter plugin (#121)
Add IPV6 filter plugin

SUMMARY


ISSUE TYPE


New Module Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Nathaniel Case <this.is@nathanielca.se>
Reviewed-by: None <None>
2022-01-20 13:10:31 +00:00