[BUG] archive.extracted and archive.unzip with password on Windows causes Python Exception Error #61422
Closed
3 of 6 tasks
Labels
Bug
broken, incorrect, or confusing behavior
Confirmed
Salt engineer has confirmed bug/feature - often including a MCVE
Execution-Module
Sulfur v3006.0
release code name and version
Milestone
Description
Creating a state to extract a zip file with a password on it causes the following error:
Exception encountered unpacking zipfile: pwd: expected bytes, got str
Setup
(Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)
Sample SLS:
Password has been entered with single and double-quotes with the same issue.
Command line sample:
Ubuntu 18.04 and 20.04 docker
Steps to Reproduce the behavior
Use either the above state or the salt command above to reproduce. Debug logs here:
Expected behavior
Expected the file to be unzipped in the desired location and the password used to complete this task.
Screenshots
N/A
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Additional context
POTENTIAL RESOLUTION:
By changing line 1076 in salt/modules/archive.py from:
zfile.extract(target, dest, password)
to
zfile.extract(target, dest, password.encode())
Resolves the issue for me.
The text was updated successfully, but these errors were encountered: