saltstack / saltstack/salt

`archive.extracted` fails for `.img.xz`

Open
#55,138 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Confirmed severity-medium State-Module
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description of Issue

A very vanilla archive.extracted state is failing for XZ archives.

First, with:

    ID: /tmp/vendor-images/ubuntu-18.04.3-preinstalled-server-arm64+raspi3/0b29297cf9f2a2112d634b1e29f94507
                                Function: archive.extracted
                                  Result: False
                                 Comment: Could not guess archive_format from the value of the 'source' argument. Please set this archive_format to one of the following: tar, rar, zip
                                 Started: 17:52:20.209757
                                Duration: 4.098 ms
                                 Changes:   

And then with archive_type: zip set:

ID: /tmp/vendor-images/ubuntu-18.04.3-preinstalled-server-arm64+raspi3/0b29297cf9f2a2112d634b1e29f94507
                                Function: archive.extracted
                                  Result: False
                                 Comment: /var/cache/salt/minion/extrn_files/api/cdimage.ubuntu.com/releases/bionic/release/ubuntu-18.04.3-preinstalled-server-arm64+raspi3.img.xz is not a ZIP file. Additional info follows:
                                          
                                          archive location:
                                              /var/cache/salt/minion/extrn_files/api/cdimage.ubuntu.com/releases/bionic/release/ubuntu-18.04.3-preinstalled-server-arm64+raspi3.img.xz
                                          
                                          The following workarounds must be used for this state to proceed (assuming the source file is a valid zip archive):
                                          
                                          - 'if_missing' must be set
                                 Started: 17:54:50.135402
                                Duration: 2323.976 ms
                                 Changes:   
Setup

Run the bellow:

# unzip_state.sls
various_zip_packages:
  pkg.installed:
    - pkgs:
        - unzip
        - xz-utils

/tmp/vendor-images/ubuntu-18.04.3-preinstalled-server-arm64+raspi3/0b29297cf9f2a2112d634b1e29f94507:
  archive.extracted:
    - source: http://cdimage.ubuntu.com/releases/bionic/release/ubuntu-18.04.3-preinstalled-server-arm64+raspi3.img.xz
    - source_hash: 0b29297cf9f2a2112d634b1e29f94507
    - archive_format: zip
    - require:
        - various_zip_packages
Steps to Reproduce Issue
Versions Report
Salt Version:
           Salt: 2019.2.2-3-g71e0088
 
Dependency Versions:
           cffi: 1.13.1
       cherrypy: Not Installed
       dateutil: 2.8.0
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.10.3
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.6.2
   mysql-python: Not Installed
      pycparser: 2.19
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 3.6.8 (default, Oct  7 2019, 12:59:55)
   python-gnupg: Not Installed
         PyYAML: 3.13
          PyZMQ: 18.1.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.3.2
 
System Versions:
           dist: Ubuntu 18.04 bionic
         locale: UTF-8
        machine: x86_64
        release: 4.15.0-65-generic
         system: Linux
        version: Ubuntu 18.04 bionic
 

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the archive.extracted state entry point and reproduce the provided state with the .img.xz source and archive_format settings. Trace how the archive format is detected and handled for this source. Done means the state can process the reported XZ archive without treating it as a ZIP or requiring unrelated workarounds.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.