saltstack / saltstack/salt

archive.extracted doesn't extract when it should.

Open
#45,363 13 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description of Issue/Question

I've written a state for installing the Sysinternals Suite from a ZIP archive:

{% set version = salt['pillar.get']('sysinternals:version', '20160829') %}
sysinternals:
  archive.extracted:
    - name: C:/Tools/SysinternalsSuite
    - source: salt://Sysinternals/SysinternalsSuite-{{ version }}.zip?saltenv=base
    - source_hash: salt://Sysinternals/sha512sums?saltenv=base
    - source_hash_name: SysinternalsSuite-{{ version }}.zip
    - source_hash_update: True
    - clean: True
    - enforce_toplevel: False
    - require:
      - file: sysinternals
  file.directory:
    - name: C:/Tools/SysinternalsSuite
    - makedirs: True

Now, when I execute this state for the first time, it creates the directory and extracts the archive as expected. When executed a second time (without changing the {{ version }}), it does nothing, as expected. It also extracts as expected when given a different {{ version }} for the first time. But here's where the fun starts: If I pass in the previous {{ version }} again, it doesn't extract again, but it should.

Setup

See above.

Steps to Reproduce Issue

First run:

root@master ~ # salt myminion state.apply test
myminion:
  Name: C:/Tools/SysinternalsSuite - Function: file.directory - Result: Changed Started: - 12:32:29.254000 Duration: 3092.0 ms
  Name: C:/Tools/SysinternalsSuite - Function: archive.extracted - Result: Changed Started: - 12:32:32.347000 Duration: 9905.0 ms

Summary for myminion
------------
Succeeded: 2 (changed=2)
Failed:    0
------------
Total states run:     2
Total run time:  12.997 s

2nd run, same version:

root@master ~ # salt myminion state.apply test
myminion:
  Name: C:/Tools/SysinternalsSuite - Function: file.directory - Result: Clean Started: - 12:33:02.737000 Duration: 4055.0 ms
  Name: C:/Tools/SysinternalsSuite - Function: archive.extracted - Result: Clean Started: - 12:33:06.793000 Duration: 6484.0 ms

Summary for myminion
------------
Succeeded: 2
Failed:    0
------------
Total states run:     2
Total run time:  10.539 s

3rd run, different version:

root@master ~ # salt myminion state.apply test pillar='{"sysinternals": {"version": "20161118"}}'
myminion:
  Name: C:/Tools/SysinternalsSuite - Function: file.directory - Result: Clean Started: - 12:37:31.944000 Duration: 6956.0 ms
  Name: C:/Tools/SysinternalsSuite - Function: archive.extracted - Result: Changed Started: - 12:37:38.901000 Duration: 10016.0 ms

Summary for myminion
------------
Succeeded: 2 (changed=1)
Failed:    0
------------
Total states run:     2
Total run time:  16.972 s

4th run, back to default version:

root@master ~ # salt myminion state.apply test
myminion:
  Name: C:/Tools/SysinternalsSuite - Function: file.directory - Result: Clean Started: - 12:38:04.759000 Duration: 4554.0 ms
  Name: C:/Tools/SysinternalsSuite - Function: archive.extracted - Result: Clean Started: - 12:38:09.314000 Duration: 6143.0 ms

Summary for myminion
------------
Succeeded: 2
Failed:    0
------------
Total states run:     2
Total run time:  10.697 s
Versions Report
root@master ~ # salt --versions-report
Salt Version:
           Salt: 2017.7.2

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.4.2
      docker-py: Not Installed
          gitdb: 0.6.4
      gitpython: 1.0.1
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: 1.0.3
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.12 (default, Nov 20 2017, 18:23:56)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.2.0
           RAET: Not Installed
          smmap: 0.9.0
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4

System Versions:
           dist: Ubuntu 16.04 xenial
         locale: UTF-8
        machine: x86_64
        release: 4.4.0-1041-aws
         system: Linux
        version: Ubuntu 16.04 xenial

Same version on Windows minion.

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 four-run state.apply sequence while switching the Sysinternals version. Trace why returning to the earlier archive is reported Clean; done means the version A → B → A sequence correctly extracts the requested archive again, with regression coverage for that behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops, infrastructure
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.