salt.states.archive.extracted doesn't extract zip if destination files exist
I have a problem with Archive.extracted.
My state:
Archive.extracted('/usr/local/bin',
source='http://file',
makedirs='True',
archive_format='zip',
owner='root',
group='root',
mode='0755',
source_hash='md5=hash',
if_missing='/usr/local/bin/file',
keep='True')
Salt runs unzip to extract archive:
[INFO ] Executing command ['unzip', '/var/cache/salt/minion/files/base/_usr_local_bin_packer-0.7.5.zip', '-d', '/usr/local/bin'] in directory '/root'
If target files exist unzip waits for "y" key.
I propose to add something like unzip_options like tar_options for tar achives.
@es1o, thanks for the report.
+1
I think the state should fail if the archive is not fully extracted for whatever reason. Right now, it returns success with a message instead of a file list:
ID: archive
Function: archive.extracted
Name: /applis/app
Result: True
Comment: salt://pkg/app.zip extracted in /applis/app/
Started: 13:02:53.882210
Duration: 5887.459 ms
Changes:
----------
directories_created:
- /applis/app/
extracted_files:
- Archive: /var/cache/salt/minion/files/base/app.zip
- replace /applis/app/File? [y]es, [n]o, [A]ll, [N]one, [r]ename: NULL
- (EOF or read error, treating as "[N]one" ...)
Ping @abednarik.
Ok. Will check.
HI @dr4Ke
Which version are you using? Looks like you are not using the version with the PR I sent to pass zip options. Try the patch I send, so you overwrite / replace files. I think that you are reporting more or less a bug. Can you confirm this? I that case, I think that should be another issue. What do you think @jfindlay?
Thanks.
+1
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.