Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxWarning: invalid escape sequence '\w' #492

Open
jpie-sbab opened this issue Mar 15, 2024 · 1 comment · May be fixed by #511
Open

SyntaxWarning: invalid escape sequence '\w' #492

jpie-sbab opened this issue Mar 15, 2024 · 1 comment · May be fixed by #511
Labels
bug Something isn't working

Comments

@jpie-sbab
Copy link

Describe the bug

v3.2.0
Running playbook with task for deploying security policies:
- name: Deploy Security Policies to NSX-T
vmware.ansible_for_nsxt.nsxt_policy_security_policy:
output:
:117: SyntaxWarning: invalid escape sequence '\w'
:120: SyntaxWarning: invalid escape sequence '\w'

Reproduction steps

  1. Use ansible 8.6, python 3.12.2
  2. Install collection: ansible-galaxy collection install git+https://github.com/vmware/ansible-for-nsxt.git,v3.2.0
  3. Run playbook with task using vmware.ansible_for_nsxt.nsxt_policy_security_policy:
    ...

Expected behavior

No syntaxwarning in output

Additional context

I have traced the 117 and 120 lines:

grep -rn '\\w' .ansible/collections/ansible_collections/vmware/
.ansible/collections/ansible_collections/vmware//ansible_for_nsxt/plugins/module_utils/vmware_nsxt.py:117:        if re.match("-+BEGIN[ \w]+PRIVATE[ ]+KEY-+", string):
.ansible/collections/ansible_collections/vmware//ansible_for_nsxt/plugins/module_utils/vmware_nsxt.py:120:        elif re.match("-+END[ \w]+PRIVATE[ ]+KEY-+", string):
@jpie-sbab jpie-sbab added the bug Something isn't working label Mar 15, 2024
@erempel
Copy link

erempel commented Aug 1, 2024

here is a patch
ansible-for-nsxt-invalid_escape_sequence.txt

@nebb00 nebb00 linked a pull request Aug 21, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants