Skip to content

Commit

Permalink
ACE dotted object-group parsing fixed (#239)
Browse files Browse the repository at this point in the history
* ACE dotted object-group parsing fixed

* changelog fragment added

* add gathered tests

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

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

* update pending files

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

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

* fix

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

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

* sanity

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

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

* check

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

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

---------

Co-authored-by: Vladimir Rulev <[email protected]>
Co-authored-by: Sagar Paul <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
4 people authored Jan 3, 2025
1 parent 3ada1f5 commit 9c2cdd7
Show file tree
Hide file tree
Showing 20 changed files with 582 additions and 90 deletions.
1 change: 1 addition & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
---

profile: production
67 changes: 67 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[flake8]

builtins = _

# Print the total number of errors:
count = true

# Don't even try to analyze these:
extend-exclude =
# No need to traverse egg info dir
*.egg-info,
# tool cache dirs
*_cache
# project env vars
.env,
# GitHub configs
.github,
# Cache files of MyPy
.mypy_cache,
# Cache files of pytest
.pytest_cache,
# Temp dir of pytest-testmon
.tmontmp,
# Occasional virtualenv dir
.venv
# VS Code
.vscode,
# Temporary build dir
build,
# This contains sdists and wheels of ansible-navigator that we don't want to check
dist,
# Metadata of `pip wheel` cmd is autogenerated
pip-wheel-metadata,
# adjacent venv
venv
# ansible won't let me
__init__.py

# IMPORTANT: avoid using ignore option, always use extend-ignore instead
# Completely and unconditionally ignore the following errors:
extend-ignore =
F841,
# line-length
E501,
# module level import not at top of file
E402

# Accessibility/large fonts and PEP8 unfriendly:
max-line-length = 120

# Allow certain violations in certain files:
# Please keep both sections of this list sorted, as it will be easier for others to find and add entries in the future
per-file-ignores =
# The following ignores have been researched and should be considered permanent
# each should be preceeded with an explanation of each of the error codes
# If other ignores are added for a specific file in the section following this,
# these will need to be added to that line as well.


# S101: Allow the use of assert within the tests directory, since tests require it.
tests/**.py: S101

# The following were present during the initial implementation.
# They are expected to be fixed and unignored over time.

# Count the number of occurrences of each error/warning code and print a report:
statistics = true
9 changes: 7 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ repos:
hooks:
- id: add-trailing-comma

- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v4.0.0-alpha.8"
- repo: https://github.com/pycontribs/mirrors-prettier
rev: "v3.4.2"
hooks:
- id: prettier
entry: env CI=1 bash -c "prettier --list-different . || ec=$? && prettier --loglevel=error --write . && exit $ec"
Expand All @@ -44,3 +44,8 @@ repos:
rev: 24.10.0
hooks:
- id: black

- repo: https://github.com/pycqa/flake8
rev: 7.1.1
hooks:
- id: flake8
8 changes: 2 additions & 6 deletions bindep.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,5 @@
# see https://docs.openstack.org/infra/bindep/ for additional information.

gcc-c++ [doc test platform:rpm]

# ansible-pylibssh
gcc [compile test platform:rpm]
libssh-devel [compile test platform:rpm]
python3-Cython [test platform:fedora-35]
python3-Cython [compile platform:centos-8 platform:rhel-8]
python3-devel [test platform:rpm]
python3 [test platform:rpm]
2 changes: 2 additions & 0 deletions changelogs/fragments/239-ace-object-group-fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- cisco.asa.asa_acls - fixed ace parsing when source is object-group and its name contains dots
2 changes: 1 addition & 1 deletion plugins/module_utils/network/asa/rm_templates/acls.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def __init__(self, lines=None):
not in source and 'object-group' not in source %}{{ source.split(' ')[0] }}{% elif source is defined and\
'::' in source and 'host' not in source %}{{ source }}{% endif %}",
"netmask": "{{ source.split(' ')[1] if source\
is defined and '.' in source and 'host' not in source else None and 'object-group' not in source }}",
is defined and '.' in source and 'host' not in source and 'object-group' not in source else None }}",
"any4": "{{ True if source is defined and source == 'any4' else None }}",
"any6": "{{ True if source is defined and source == 'any6' else None }}",
"any": "{{ True if source is defined and source == 'any' else None }}",
Expand Down
10 changes: 6 additions & 4 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
black==23.3.0 ; python_version >= '3.7'
# For ansible-tox-linters
black==23.3.0
flake8
pexpect
pytest-xdist
yamllint

# Unit test runner
pytest-ansible
pytest-xdist
pytest-ansible ; python_version >= '3.9'
pytest-cov
7 changes: 0 additions & 7 deletions tests/sanity/ignore-2.10.txt

This file was deleted.

8 changes: 0 additions & 8 deletions tests/sanity/ignore-2.11.txt

This file was deleted.

5 changes: 0 additions & 5 deletions tests/sanity/ignore-2.12.txt

This file was deleted.

1 change: 0 additions & 1 deletion tests/sanity/ignore-2.13.txt

This file was deleted.

10 changes: 10 additions & 0 deletions tests/sanity/ignore-2.15.txt
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
plugins/action/asa.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
tests/unit/modules/network/asa/test_asa_acls.py E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py E501: line too long (161 > 160 characters)
10 changes: 10 additions & 0 deletions tests/sanity/ignore-2.16.txt
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
plugins/action/asa.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
tests/unit/modules/network/asa/test_asa_acls.py:91:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:173:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:383:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:469:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:679:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:758:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:968:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:1017:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:1065:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:1130:161: E501: line too long (161 > 160 characters)
10 changes: 10 additions & 0 deletions tests/sanity/ignore-2.17.txt
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
plugins/action/asa.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
tests/unit/modules/network/asa/test_asa_acls.py:91:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:173:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:383:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:469:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:679:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:758:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:968:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:1017:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:1065:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:1130:161: E501: line too long (161 > 160 characters)
10 changes: 10 additions & 0 deletions tests/sanity/ignore-2.18.txt
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
plugins/action/asa.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
tests/unit/modules/network/asa/test_asa_acls.py:91:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:173:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:383:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:469:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:679:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:758:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:968:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:1017:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:1065:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:1130:161: E501: line too long (161 > 160 characters)
10 changes: 10 additions & 0 deletions tests/sanity/ignore-2.19.txt
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
plugins/action/asa.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
tests/unit/modules/network/asa/test_asa_acls.py:91:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:173:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:383:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:469:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:679:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:758:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:968:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:1017:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:1065:161: E501: line too long (161 > 160 characters)
tests/unit/modules/network/asa/test_asa_acls.py:1130:161: E501: line too long (161 > 160 characters)
7 changes: 0 additions & 7 deletions tests/sanity/ignore-2.9.txt

This file was deleted.

Loading

0 comments on commit 9c2cdd7

Please sign in to comment.