lae / ansible-role-proxmox

IaC for Proxmox VE clusters.
MIT License
496 stars 144 forks source link

pvesh: Fix invalid string escape sequences #244

Closed tbabej closed 3 months ago

tbabej commented 4 months ago

In Python, only a limited set of characters can be escaped with a backslash. In recent versions of Python, attempting to escape a non-escapeable character raises a SyntaxWarning, polluting the playbook output with warnings like:

<unknown>:59: SyntaxWarning: invalid escape sequence '\('
<unknown>:60: SyntaxWarning: invalid escape sequence '\.'
<unknown>:61: SyntaxWarning: invalid escape sequence '\.'

This commit adds the string literal prefix 'r' to regular expressions in pvesh.py to ensure that escape sequences are not interpreted in the given strings. As there were no valid escape sequences in those strings to begin with, the actual string content remains the same.

lae commented 3 months ago

Huh, I don't know how I missed this PR. Thanks!