salt icon indicating copy to clipboard operation
salt copied to clipboard

salt.states.archive.extracted doesn't extract zip if destination files exist

Open es1o opened this issue 11 years ago • 8 comments

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 avatar May 15 '15 07:05 es1o

@es1o, thanks for the report.

jfindlay avatar May 18 '15 18:05 jfindlay

+1

danlsgiga avatar Feb 05 '16 21:02 danlsgiga

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" ...)

dr4Ke avatar Feb 11 '16 13:02 dr4Ke

Ping @abednarik.

jfindlay avatar Feb 12 '16 00:02 jfindlay

Ok. Will check.

abednarik avatar Feb 12 '16 00:02 abednarik

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.

abednarik avatar Feb 21 '16 12:02 abednarik

+1

vim-zz avatar Oct 06 '16 08:10 vim-zz

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.

stale[bot] avatar Jul 08 '18 09:07 stale[bot]