ionos-cloud / module-ansible

Apache License 2.0
10 stars 8 forks source link

SyntaxWarning: invalid escape sequence '\w' in server.py #199

Closed jaudriga closed 2 months ago

jaudriga commented 5 months ago

Description

When running an Ansible Playbook that uses the IONOS Cloud Ansible module (ionoscloudsdk.ionoscloud.server), I encountered the following warning:

/tmp/ansible_ionoscloudsdk.ionoscloud.server_payload_17tli3ut/ansible_ionoscloudsdk.ionoscloud.server_payload.zip/ansible_collections/ionoscloudsdk/ionoscloud/plugins/modules/server.py:588: SyntaxWarning: invalid escape sequence '\w'

This warning is caused by an invalid escape sequence in line 588 of the server.py file:

uuid_match = re.compile('[\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12}', re.I)

Expected behavior

No warning. This might also cause some issues as it might affect the regex search (not sure which yet).

Environment

Configuration Files

Nothing special

How to Reproduce

  1. Create an Ansible Playbook that uses the ionoscloudsdk.ionoscloud.cube_server module.
  2. Run the Playbook.
  3. The warning SyntaxWarning: invalid escape sequence '\w' is displayed in the output.

Additional Notes

The warning can be resolved by prefixing the string on line 588 with r to create a raw string literal.

This change should eliminate the SyntaxWarning without affecting the functionality of the module.

rmocanu-ionos commented 2 months ago

Hello, this should be fixed in the latest beta release, v7.5.0-beta.1, please let us know is the issue persists