Skip to content

salt.runner does not pass the saltenv arg #33388

Closed

Description

@ealphonse

Description of Issue/Question

When I use salt.runner to call state.orchestrate the saltenv arg is ignored, but not the other args. Calling state.orchestrate using module.run -> saltutil.runner as shown in #31851 works as expected.

Setup

  • two saltenvs: base and jenkins
  • salt/jenkins/orch1.sls:
echo {{ pillar.options.a }}:
  cmd.run
  • salt/base/orch2.sls:
test1:
  salt.runner:
    - name: state.orchestrate
    - mods: orch1
    - saltenv: jenkins
    - pillar:
        options: {a: toto}

#test2:
#  module.run:
#    - name: saltutil.runner
#    - _fun: state.orchestrate
#    - kwargs:
#        mods: orch1
#        pillar: {options: {a: toto}}
#        saltenv: jenkins

Steps to Reproduce Issue

# salt-run -l debug state.orchestrate orch2
...skipped...
[DEBUG   ] Could not find file from saltenv 'base', u'salt://orch1.sls'
[DEBUG   ] Could not find file from saltenv 'base', u'salt://orch1/init.sls'
[DEBUG   ] compile template: False
[ERROR   ] Template was specified incorrectly: False
sarje-infra:
    Data failed to compile:
----------
    No matching sls found for 'orch1' in env 'base'
sarje-infra:
----------
          ID: test1
    Function: salt.runner
        Name: state.orchestrate
      Result: True
     Comment: Runner function 'state.orchestrate' executed.
     Started: 05:54:18.949730
    Duration: 13768.262 ms
     Changes:   
              ----------
              data:
                  ----------
                  sarje-infra:
                      - No matching sls found for 'orch1' in env 'base'
              outputter:
                  highstate

Summary for sarje-infra
------------
Succeeded: 1 (changed=1)
Failed:    0
------------
Total states run:     1

Note it also succeeds. Now, calling the other test (commented out) or moving the file to the base env works as expected.

# salt-run -l error state.orchestrate orch2
sarje-infra:
----------
          ID: echo toto
    Function: cmd.run
      Result: True
     Comment: Command "echo toto" run
     Started: 05:46:07.945141
    Duration: 75.73 ms
     Changes:   
              ----------
              pid:
                  20017
              retcode:
                  0
              stderr:
              stdout:
                  toto

Summary for sarje-infra
------------
Succeeded: 1 (changed=1)
Failed:    0
------------
Total states run:     1
sarje-infra:
----------
          ID: test2
    Function: module.run
        Name: saltutil.runner
      Result: True
     Comment: Module function saltutil.runner executed
     Started: 05:45:54.134308
    Duration: 13919.848 ms
     Changes:   
              ----------
              ret:
                  ----------
                  data:
                      ----------
                      sarje-infra:
                          ----------
                          cmd_|-echo toto_|-echo toto_|-run:
                              ----------
                              __run_num__:
                                  0
                              changes:
                                  ----------
                                  pid:
                                      20017
                                  retcode:
                                      0
                                  stderr:
                                  stdout:
                                      toto
                              comment:
                                  Command "echo toto" run
                              duration:
                                  75.73 ms
                              name:
                                  echo toto
                              result:
                                  True
                              start_time:
                                  05:46:07.945141
                  outputter:
                      highstate

Summary for sarje-infra
------------
Succeeded: 1 (changed=1)
Failed:    0
------------
Total states run:     1

Versions Report

Same for master and minion:

Salt Version:
           Salt: 2015.8.8

Dependency Versions:
         Jinja2: 2.7.2
       M2Crypto: Not Installed
           Mako: 0.9.1
         PyYAML: 3.10
          PyZMQ: 14.0.1
         Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
           RAET: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.4
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 1.5
          gitdb: 0.5.4
      gitpython: 0.3.2 RC1
          ioflo: Not Installed
        libgit2: Not Installed
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.3.0
   mysql-python: 1.2.3
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
   python-gnupg: 0.3.6
          smmap: 0.8.2
        timelib: Not Installed

System Versions:
           dist: Ubuntu 14.04 trusty
        machine: x86_64
        release: 3.13.0-24-generic
         system: Ubuntu 14.04 trusty

Activity

  1. Ch3LL commented on May 20, 2016

    @Ch3LL
    Contributor

    @ealphonse I am also able to replicate this behavior.

    [DEBUG   ] LazyLoaded nested.output
    ch3ll-master_master:
    ----------
              ID: test1
        Function: salt.runner
            Name: state.orchestrate
          Result: True
         Comment: Runner function 'state.orchestrate' executed.
         Started: 16:47:15.579865
        Duration: 224771.148 ms
         Changes:   
                  ----------
                  data:
                      ----------
                      ch3ll-master_master:
                          - No matching sls found for 'test1' in env 'base'
                  outputter:
                      highstate
    
    Summary for ch3ll-master_master
    ------------
    Succeeded: 1 (changed=1)
    Failed:    0
    ------------
    
    test1:
      salt.runner:
        - name: state.orchestrate
        - mods: test1
        - saltenv: test
        - pillar:
            test1: itworked
    

    on version salt 2015.8.8.2

    But can run it via:

    ➜  salt sudo salt-run state.orchestrate test1 saltenv=test                                                                                                               
    [sudo] password for ch3ll: 
    [WARNING ] Template is an empty file: /srv/salt/pillar/top.sls
    ch3ll-master_master:
    ----------
              ID: create_test1_file
        Function: cmd.run
            Name: touch /tmp/
          Result: True
         Comment: Command "touch /tmp/" run
         Started: 16:54:45.468366
        Duration: 9.48 ms
         Changes:   
                  ----------
                  pid:
                      28759
                  retcode:
                      0
                  stderr:
                  stdout:
    
    Summary for ch3ll-master_master
    ------------
    Succeeded: 1 (changed=1)
    Failed:    0
    ------------
    Total states run:     1
    ➜  salt 
    
  2. added
    bug
    P4
    severity-medium
    Core
    on May 20, 2016
  3. added this to the Approved milestone on May 20, 2016
  4. rallytime commented on Oct 18, 2016

    @rallytime
    Contributor

    I think the fix in #35049 addresses this. @ealphonse Can you give that a try and let us know if that resolves the issue for you? That fix will be available in the carbon release.

  5. added
    fixed-pls-verify
    on Oct 18, 2016
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

    CoreP4Runnersbugfixed-pls-verifyseverity-medium

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions