Skip to content

when using 'prereq' in orchestration pre-requiring state does not run #49753

Closed

Description

@angeloudy

Description of Issue/Question

When using 'prepreq' in orchestration, I can see that the pre-required state first runs with test=True and then runs in real, but the pre-requiring state did not run at all.

Setup

orchestration/test.sls

test3:
  salt.state:
    - tgt: 'region1.freebsd1'
    - sls:
        - myapp.test

test2:
  cmd.run:
    - name: "echo test2"
    - prereq:
      - test3
myapp/test.sls

/tmp/testfile:
  file.managed:
    - contents: 'abcd'

Steps to Reproduce Issue

salt-run state.orch orchestration.test -l trace

test3 will run twice, first time in test mode, second time in real, but test2 never run.

Versions Report

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)

Salt Version:
           Salt: 2018.3.1

Dependency Versions:
           cffi: 1.11.5
       cherrypy: unknown
       dateutil: 2.7.2
      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: 1.3.12
      pycparser: 2.18
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 3.6.6 (default, Jul 27 2018, 19:19:07)
   python-gnupg: Not Installed
         PyYAML: 3.12
          PyZMQ: 17.0.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.2.3

System Versions:
           dist:
         locale: UTF-8
        machine: amd64
        release: 11.2-RELEASE
         system: FreeBSD
        version: Not Installed

Activity

  1. angeloudy commented on Sep 24, 2018

    @angeloudy
    ContributorAuthor

    I think this is probably related to #40208
    I made the following change to test

    --- a/salt/states/file.py
    +++ b/salt/states/file.py
    @@ -2366,7 +2366,8 @@ def managed(name,
                 else:
                     ret['result'] = True
                     ret['comment'] = u'The file {0} is in the correct state'.format(name)
    -
    +            if ret['pchanges']:
    +                ret['changes'] = ret['pchanges']
                 return ret
    
             # If the source is a list then find which file exists
    

    and then the prereq worked as expected.

  2. Ch3LL commented on Sep 24, 2018

    @Ch3LL
    Contributor

    looks like you have a grasp of the change. would you be willing to submit that as a PR?

  3. added
    bug
    severity-medium
    P4
    on Sep 24, 2018
  4. added this to the Approved milestone on Sep 24, 2018
  5. angeloudy commented on Sep 25, 2018

    @angeloudy
    ContributorAuthor

    @Ch3LL that's just my work around. I don't understand why do we need pachanges, what it's for?

  6. Ch3LL commented on Sep 28, 2018

    @Ch3LL
    Contributor

    we were just actually talking internally about the need for this and I believe we decided it needs to be removed as it wasn't fully implemented, but i know @terminalmage was the one that was going to work on this so he can give more insight.

  7. terminalmage commented on Sep 28, 2018

    @terminalmage
    Contributor

    This is the same root issue as #45895 and will be fixed later today. I'm wrapping up integration tests right now.

  8. added
    fixed-pls-verify
    on Sep 28, 2018
  9. terminalmage commented on Sep 29, 2018

    @terminalmage
    Contributor

    See #49832

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4bugfixed-pls-verifyseverity-medium

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions