Skip to content

sls with empty output leads to "requisites were not found" #30971

@skandyla

Description

@skandyla

Hi,

In this example I have two states, which retrieve some data from pillar.
One state is depend from another.
The error occurs when the first state doesn't get any data from pillar, so it produces zero output, and the second state fails with The following requisites were not found: require: sls:

          ID: custompkgs_httpd
    Function: pkg.installed
        Name: httpd
      Result: False
     Comment: The following requisites were not found:
                                 require:
                                     sls: repos.custom

The first state:
salt/repos/custom.sls:

{% if grains['os'] == 'CentOS' %}                                                    
{% for yumrepo in salt['pillar.get']('yumrepos',{}) %}                               
{{ yumrepo }}_repo:                                                                  
  file.managed:                                                                      
    - name: /etc/yum.repos.d/{{ yumrepo }}.repo                                      
    - contents_pillar: yumrepos:{{ yumrepo }}                                        
    - mode: 600                                                                      
    - user: root                                                                     
{% endfor %}                                                                         
{% endif %}   

The second state:
salt/packages/init.sls:

include:
  - repos.custom

{% for package, status in pillar.get('custompkgs', {}).items() %}                    
custompkgs_{{ package }}:                                                            
  pkg:                                                                               
    - name: {{ package }}                                                            
    - {{ status }}
    - require:
      - sls: repos.custom
{% endfor %} 

The second state is depend from the first, because I quite often deploy my private repositories and install custom packages which are depend from that private repositories.

Test's pillar data for the host:

custompkgs:                                                                          
  httpd: installed

When the first state (repos.custom) provide some output (I mean {% for package, status in pillar.get('custompkgs', {}).items() %} ) even without any changes, everything works fine.

Fox example, if I add some data to the pillar:

yumrepos:                                                                           
  tmp: |                                                                            
    #tmp 

everything works good.

Versions:

# salt-ssh --versions
Salt Version:
           Salt: 2015.8.5

Dependency Versions:
         Jinja2: 2.7.3
       M2Crypto: 0.21.1
           Mako: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.7.0
         Python: 2.7.5 (default, Nov 20 2015, 02:00:19)
           RAET: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.4.2
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
        libgit2: Not Installed
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
   python-gnupg: Not Installed
          smmap: Not Installed
        timelib: Not Installed

System Versions:
           dist: centos 7.2.1511 Core
        machine: x86_64
        release: 3.10.0-327.3.1.el7.x86_64
         system: CentOS Linux 7.2.1511 Core

Metadata

Metadata

Assignees

No one assigned

    Labels

    Corerelates to code central or existential to SaltState-Compilerbugbroken, incorrect, or confusing behaviorhelp-wantedCommunity help is needed to resolve thispending-community-assignmentPending community contributor assignmentseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work aroundtest:fullRun the full test suite

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions