Skip to content

Conversation

alperenkose
Copy link
Collaborator

@alperenkose alperenkose commented Sep 24, 2024

Description

Regex expressions in gathered state gathered_filter required extra escape chars which wasn't a valid regex in deed.
This PR allows to write valid regex expression in the gathered_filter, the previous syntax is not valid anymore hence this is introducing a breaking change.

shlex.split() was used to split logic expressions in the gathered_filter, which also escaped(removed) backslash \ chars from the expression and led to a non-working regex. We have implemented our split method using shlex but removing backslash(\) escape char from shlex instance to avoid escaping and properly processing regex expressions.

Motivation and Context

Fixes #579

How Has This Been Tested?

Tested on vm firewalls with examples in the issue.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes if appropriate.
  • All new and existing tests passed.

Removed backslash(\) escape char from shlex to avoid escaping
and properly processing regex expressions.
@alperenkose alperenkose force-pushed the 579-gathered_filter-regex-escape-characters branch from 3c5eb74 to 15226e3 Compare September 24, 2024 09:17
@alperenkose alperenkose marked this pull request as ready for review September 24, 2024 09:17
Copy link
Collaborator

@horiagunica horiagunica left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@alperenkose alperenkose merged commit ae4103a into beta Oct 1, 2024
16 checks passed
github-actions bot pushed a commit that referenced this pull request May 16, 2025
## [3.0.0](v2.21.4...v3.0.0) (2025-05-16)

### ⚠ BREAKING CHANGES

* merge beta to develop for a new major release (#618)
* drop crypto_profile_name alias in panos_ike_gateway
* `gathered_filter` in 'gathered' state now accepts valid regex
expressions, the previous syntax with extra escape characters is not valid anymore.

### Bug Fixes

* gathered_filter to process regex correctly ([#583](#583)) ([ae4103a](ae4103a))

### Miscellaneous Chores

* merge beta to develop for a new major release ([#618](#618)) ([f89f05a](f89f05a))
* support ansible-core 2.16 to 2.18 - drop python 3.9 ([#604](#604)) ([3b0f5ab](3b0f5ab))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants