saltstack / saltstack/salt

During test mode archive.extracted returns result=None when it should return result=True; breaks prereq.

Open
#52,748 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description of Issue/Question

archive.extracted does not detect it's own correct state during a test run. This causes any states depending on it in prereq to always run, even when there are no changes for the state.

Setup
extract_state:
  archive.extracted:
    - name: /opt/salt-bootstrap
    - source: https://github.com/saltstack/salt-bootstrap/archive/v2019.01.08.tar.gz
    - source_hash: 38ae8f0b6a32c5fb23e27c37a4e321f8

prereq_state:
  cmd.run:
    - name: 'echo I should only run when the archive is going to be extracted'
    - prereq:
      - archive: extract_state
Steps to Reproduce Issue

Run the above state twice

local:
----------
          ID: prereq_state
    Function: cmd.run
        Name: echo I should only run when the archive is going to be extracted
      Result: True
     Comment: Command "echo I should only run when the archive is going to be extracted" run
     Started: 14:08:45.874769
    Duration: 8.299 ms
     Changes:   
              ----------
              pid:
                  2374
              retcode:
                  0
              stderr:
              stdout:
                  I should only run when the archive is going to be extracted
----------
          ID: extract_state
    Function: archive.extracted
        Name: /opt/salt-bootstrap
      Result: True
     Comment: All files in archive are already present
     Started: 14:08:45.883397
    Duration: 36.349 ms
     Changes:   

Summary for local
------------
Succeeded: 2 (changed=1)
Failed:    0
------------
Total states run:     2
Total run time:  44.648 ms
Versions Report
Salt Version:
           Salt: 2019.2.0
 
Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.7.0
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.10
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           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: Not Installed
         Python: 2.7.15 (default, Oct 15 2018, 15:26:09)
   python-gnupg: Not Installed
         PyYAML: 4.2
          PyZMQ: 17.0.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 5.0.2
            ZMQ: 4.1.6
 
System Versions:
           dist: fedora 29 Twenty Nine
         locale: ANSI_X3.4-1968
        machine: x86_64
        release: 4.20.4-200.fc29.x86_64
         system: Linux
        version: Fedora 29 Twenty Nine

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 execution path and its test-mode handling, then trace how its result is consumed by prereq. Reproduce the provided state twice and verify that an unchanged archive reports result=True without running the dependent command; add or update coverage for this behavior if the relevant test location is found.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.