vmware / ansible-for-nsxt

Ansible delivers simple IT automation that ends repetitive tasks and frees up DevOps teams for more strategic work. This project is to enable this automation for NSX-T installation.
Other
169 stars 140 forks source link

SyntaxWarning: invalid escape sequence '\w' #492

Open jpie-sbab opened 6 months ago

jpie-sbab commented 6 months ago

Describe the bug

v3.2.0 Running playbook with task for deploying security policies:

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):
erempel commented 1 month ago

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