Commit Graph

125 Commits (main)

Author SHA1 Message Date
Vinay M dda46ee3cf
Fixes tests that use AnsibleUndefined (#383)
* Fixes tests that use AnsibleUndefined

* add change log

* add same for other cases
2024-12-17 13:47:07 +05:30
Vinay M d902c0f4f9
Fixes keep_keys filter to retain the entire node when a key match occurs, rather than just the leaf node values. (#377)
* Fix keep_keys not keeping the values if they are not a string

* added changelog

* remove inventory

* add tests

* added more test
2024-09-27 19:53:27 +05:30
Vinay M aa44958bd2
Fixes issue with keep_keys removing all keys when passed a dict. (#370)
* Fixes issue with keep_keys removing all keys when data is passed in as dict

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

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

* changed var name

* updated changelog

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-09-04 20:15:08 +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
Ruchi Pakhle 1df7af5ab2
fix the variable collision issue in downstream tests (#364)
* fix the variable collision issue

* make output format in such a way that it returns a dict

* changes

* changes

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

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

* revert back changes

* changes

* changes

* fix the error

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

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

* add dict construct

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-08-01 23:44:14 +05:30
Emanuele Bernardi 540e0d8963
fix from_xml: return python dictionary (#361)
* removed the in between json conversion, now function returns python
dict, changed unit tests to check against the dict.

* remove the json import

* changelog added

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

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

* changed changelog to minor

---------

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: Nilashish Chakraborty <nilashishchakraborty8@gmail.com>
2024-07-25 22:20:32 +05:30
Vladimir Botka 6c1c3a4b81
remove_keys: Add complex integration tests. (#204)
* remove_keys: Add complex integration tests.

* Changelog

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

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

* fix lint

* fix more lint

* rewrite test

* fix lint

* fix lint again

* fix lint final

* fix lint warnings

* remove unnecessary file

* fix spacing

* added seprate file for vars

* fix intergration tests

---------

Co-authored-by: Vinay M <63404819+roverflow@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: roverflow <roverflow5@gmail.com>
2024-07-22 12:22:48 +05:30
Vladimir Botka 41339232c3
keep_keys: Add complex integration tests. (#203)
* keep_keys: Add complex integration tests.

* Changelog

* fix lint

* fix lint warnings

* fix final warning

* add seprate file for vars

---------

Co-authored-by: Vinay M <63404819+roverflow@users.noreply.github.com>
Co-authored-by: roverflow <roverflow5@gmail.com>
2024-07-22 12:10:55 +05:30
Vladimir Botka 3aeb82204f
replace_keys: Add complex integration tests. (#200)
* replace_keys: Add complex integration tests.

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

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

* Changelog

* Add fail_msg to first test.

* some changes

* adds correct integration tests :D

* delete the inventory file

* use fqcn format

* delete the unwanted file

* fix integration test

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

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

* update

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ruchi Pakhle <ruchipakhle@gmail.com>
2024-07-19 15:46:44 +05:30
Marcin Lewandowski fc3a2a116b
fix: netaddr fallback to is_private when is_global is not available (#348)
* fix: netaddr fallback to is_private when is_global is not available

* fix: adjust fallback logic to edge cases

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

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

* fix: address pylint errors

* fix: comment spacing in test task broken by prettier

* changelog update

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

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

---------

Co-authored-by: Marcin Lewandowski <mlewandowski@pl.ibm.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ruchi Pakhle <ruchipakhle@gmail.com>
2024-04-15 16:11:26 +05:30
Ruchi Pakhle 1645351602
Remove Py27 compat files and update imports for magicmock and patch (#342)
* remove compat files and mock imports

* updates

* updates

* [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-03-28 11:30:53 +05:30
rizlas c176c23392
fix: netaddr is_private method deprecation (#338)
* fix: netaddr is_private method deprecation

* Update ipaddr.yaml

* Fix integretion test

* Update ipaddr.yaml

* Update main.yaml

* changelog: add changelog fragment about netaddr deprecation

* netaddr minimum version

---------

Co-authored-by: Ashwini Mhatre <amhatre@redhat.com>
2024-03-13 21:44:50 +05:30
Sagar Paul 786fa9891d
[GHA] Update reference for GitHub actions (#318)
* Update reference for GitHub actions

* tox lint file update

* Make names consistent

* ack - check_label

* check source

* fix utils ref

* update lint workflow

* test

* test again

* fix assert statement

* update workflows

* test change

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

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

* add back token refresh

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-01-30 19:25:26 +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
Ashwini Mhatre 1424233e33
Prepare for major release (#315)
* Prepare for major release

* Add config.yml

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

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

* Update update_requires_ansible.yaml

---------

Co-authored-by: Ashwini Mhatre <amhatre@amhatre-thinkpadt14sgen2i.pnq.csb>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-11-30 15:56:37 +05:30
Ashwini Mhatre 8d822ed9d7
Fix CI (#314)
* Fix syntax

* Fix tests

* Fix

* Fix

* Delete tests/integration/inventory

* Update module.yaml

* Update module.yaml

* Make config validate work after core updates

Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>

* Fix tests

Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>

* Another test fix and README update

Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>

---------

Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>
Co-authored-by: Ashwini Mhatre <amhatre@amhatre-thinkpadt14sgen2i.pnq.csb>
Co-authored-by: NilashishC <nilashishchakraborty8@gmail.com>
2023-11-30 12:28:27 +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
Ashwini Mhatre 6adf947ed8
Enable ansible-lint for utils and fix ansible-lint issue (#278)
* Fix ansible-lint issue for utils

* fix ansible-lint

* Fix ansible-lint

* Fix ansible-lint

* Fix integration test
2023-05-19 10:43:21 +05:30
Sebastian Wiesinger c2231a6b20
Update jsonschema validator (#226)
* Update jsonschema validator

Update jsonschema validator to support newer drafts. It now supports
drafts 2019-09 and 2020-12.

The logic for choosing the jsonschema validator class has changed so
that the following enhancements are available:

- When no draft is explicitly specified we now use use the validator
  draft that is specified in the "$schema" field of the criteria. This
  is done by the jsonschema module by default and should support
  possible future drafts without any changes to this code.

- Optionally allow to disable format checks in the code. As format
  checks are not required by the spec there might be situations where
  people want to disable them.

* Update requirements.txt

* Skip all tests which dependas on jsonschema 4.5

* jsonschema: Refactor code to support python 3.6

* Fix jsonschema requirements for python<3.7

* jsonschema: Update code for compatibility

* Better documentation and error handling for missing schema specifications

* [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: Ashwini Mhatre <amhatre@redhat.com>
Co-authored-by: ashwini-mhatre <mashu97@gmail.com>
2023-04-05 11:01:12 -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
Ashwini Mhatre 09362a2d98
Fix ansible lint issues (#235)
* Fix ansible-lint issues
2022-12-28 12:37:35 +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 e5591508fa
Fix Ansible lint FQCN error (#227)
* Fix set_fact ansible-lint

* Fix assert ansible-lint

* Fix find ansible-lint

* Fix debug ansible-lint

* Add FQCN
2022-11-29 19:28:12 +05:30
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
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
Bradley A. Thornton 4fe771a95c
Enable prettier via pre-commit (#188) 2022-05-26 10:02:52 -04:00
Bradley A. Thornton 50201a1ad9
Enable integration tests with Github action (#180) 2022-05-18 11:06:59 -07:00
Nathaniel Case e76854d1e1 Move check_mode setting to the proper location regardless of version 2022-04-25 11:11:15 -04:00
cidrblock c533f5c758 Linting and test config 2022-04-13 06:01:59 -07:00
pre-commit-ci[bot] bcbc2bcdaf [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-04-11 18:43:42 +00:00
cidrblock 363fac094b Fix 2022-04-11 11:43:15 -07:00
cidrblock 4f5497549e Add init 2022-04-11 11:40:39 -07:00
cidrblock 0b67dab6c9 Another init 2022-04-11 07:25:48 -07:00
pre-commit-ci[bot] c9e21bb84b [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-04-11 07:25:48 -07:00
cidrblock 96c7b46584 sanity 2022-04-11 07:25:48 -07:00
cidrblock 79c6ad9ae5 Add init 2022-04-11 07:25:47 -07:00
KB-perByte ceb7db1cd3
del extra 2022-04-11 16:15:08 +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