saltstack / saltstack/salt

Interaction between prereq and archive.extracted

Open
#53,379 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

/opt/foo/bar:
  file.absent:
    - prereq:
      - archive: /opt/foo

/opt/foo:
  archive.extracted:
    - source: ...
    - source_hash: ...
    - source_hash_update: true
    - enforce_toplevel: false

Instead of only running file.absent before the archive is due to be extracted, it instead runs both states on every application.

... extracted to /opt/foo/, due to absence of one or more files/dirs

Removing the file state causes the archive state to (correctly) only run when the source changes or there are files missing.

Output with test=true:

----------
          ID: /opt/foo/bar
    Function: file.absent
      Result: None
     Comment: Directory /opt/foo/bar is set for removal
     Started: 12:25:58.075050
    Duration: 0.404 ms
     Changes:
              ----------
              removed:
                  /opt/foo/bar
----------
          ID: /opt/foo
    Function: archive.extracted
      Result: None
     Comment: Archive ... would be cached (if necessary) and checked to discover if extraction is needed
     Started: 12:25:58.170252
    Duration: 1.165 ms
     Changes:
Versions Report
Salt Version:
           Salt: 2018.3.4

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.6.1
      docker-py: Not Installed
          gitdb: 2.0.3
      gitpython: 2.1.8
          ioflo: Not Installed
         Jinja2: 2.10
        libgit2: 0.26.0
        libnacl: Not Installed
       M2Crypto: 0.32.0
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: 0.26.2
         Python: 3.6.7 (default, Oct 22 2018, 11:32:17)
   python-gnupg: 0.4.1
         PyYAML: 3.12
          PyZMQ: 16.0.2
           RAET: Not Installed
          smmap: 2.0.3
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.2.5

System Versions:
           dist: Ubuntu 18.04 bionic
         locale: ISO-8859-1
        machine: x86_64
        release: 4.15.0-50-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 by reading the implementations and prerequisite handling for the file.absent and archive.extracted states, then reproduce the supplied YAML with test=true. Done means the prerequisite ordering is preserved while archive.extracted remains idempotent and does not run on every application.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.