Skip to content

SyntaxWarning: invalid escape sequence '\w' #492

@jpie-sbab

Description

@jpie-sbab

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):

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions