You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Utilizing the gathered_filter with regex requires very strict usage of escape characters, which is not consistent with other ansible filters/tasks. This means that as a user, local testing of the regex using a debug may return different results than when that regex is passed to the module.
I discovered this when the regex I had successfully tested locally with a regex_search filter was not returning any results with the palo gathered_filter even though I knew the objects existed
Current regex syntax to return results:
single quotes, double escape: 'name matches-regex \\w'
Increased handling of regex escape characters when using regex for the gathered_filter.
In addition to the current behavior, I'd like to also see the following situations return results (note these are very over-simplified regex examples):
single quotes, single escape: 'name matches-regex \w'
Because the roles we create that utilize the palo modules can be consumed by other teams at our company that may not be aware of these restrictions, we've had to add a task to our roles to re-format the regex for them before the value is passed to the module
I'm including some screenshots of testing I did, including the playbook and printed output:
The playbook is run on localhost
Ansible versions:
ansible version 2.14.9
python version 3.9.16
paloaltonetworks.panos version 2.17.7 (I've tested with 2.20.0 and noticed the same behavior)
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem?
Utilizing the gathered_filter with regex requires very strict usage of escape characters, which is not consistent with other ansible filters/tasks. This means that as a user, local testing of the regex using a debug may return different results than when that regex is passed to the module.
I discovered this when the regex I had successfully tested locally with a regex_search filter was not returning any results with the palo gathered_filter even though I knew the objects existed
Current regex syntax to return results:
'name matches-regex \\w'
"name matches-regex \\\\w"
Describe the solution you'd like
Increased handling of regex escape characters when using regex for the gathered_filter.
In addition to the current behavior, I'd like to also see the following situations return results (note these are very over-simplified regex examples):
'name matches-regex \w'
"name matches-regex \\w"
Additional context
Because the roles we create that utilize the palo modules can be consumed by other teams at our company that may not be aware of these restrictions, we've had to add a task to our roles to re-format the regex for them before the value is passed to the module
I'm including some screenshots of testing I did, including the playbook and printed output:
The playbook is run on localhost
Ansible versions:
The text was updated successfully, but these errors were encountered: