Skip to content

Commit

Permalink
salt: Prevent invalid escape sequence warnings
Browse files Browse the repository at this point in the history
We need to pass `\;` to the `isoinfo` binary for reading file contents
from an ISO archive, but this escape sequence is not valid in Python,
and Python 3 warns about it.
We could have escaped the backslash, but instead rely on the raw string
notation for Python 3 (`r'my \escaped sequence'`).
  • Loading branch information
gdemonet authored and TeddyAndrieux committed Nov 16, 2020
1 parent da42e41 commit 59edec2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion salt/_modules/metalk8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def archive_info_from_iso(path):

cmd = ' '.join([
'isoinfo',
'-x', '/PRODUCT.TXT\;1',
'-x', r'/PRODUCT.TXT\;1',
'-i', '"{}"'.format(path),
])
result = __salt__['cmd.run_all'](cmd=cmd)
Expand Down
2 changes: 1 addition & 1 deletion salt/_modules/metalk8s_solutions.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def manifest_from_iso(path):

cmd = ' '.join([
'isoinfo',
'-x', '/{}\;1'.format(SOLUTION_MANIFEST.upper()),
'-x', r'/{}\;1'.format(SOLUTION_MANIFEST.upper()),
'-i', '"{}"'.format(path),
])
result = __salt__['cmd.run_all'](cmd=cmd)
Expand Down

0 comments on commit 59edec2

Please sign in to comment.