Skip to content

Merging pillars when one is empty gives empty result #33437

Description

@creideiki

Description of Issue/Question

I'm trying to merge pillar data, as suggested in #28394 (comment) . However, if the data I try to merge in happens to be empty (as a result of template rendering), the end result is completely empty, ignoring any previous data.

Setup

pillar/top.sls:

base:
  '*':
    - common
    - modules

pillar/common.sls:

program:
  modules:
    00-definitions.conf: ~
    01-cleanup.conf: ~

pillar/modules.sls:

program:
  modules:
    {% if 'test' in grains['roles'] %}
    10-dostuff.conf: ~
    {% endif %}

From this, I expect a minion with the grain roles: [test] to get the pillar {'00-definitions.conf': None, '01-cleanup.conf': None, '10-dostuff.conf': None}, while other minions should get {'00-definitions.conf': None, '01-cleanup.conf': None}.

However, what actually happens is that minions without the role test get nothing at all:

# salt --no-colour 'salt*' grains.get roles   
saltminion:
    - test
saltmaster:
    - saltmaster
# salt --no-colour 'salt*' pillar.get program
saltminion:
    ----------
    modules:
        ----------
        00-definitions.conf:
            None
        01-cleanup.conf:
            None
        10-dostuff.conf:
            None
saltmaster:
    ----------
    modules:
        None

Changing pillar_source_merging_strategy from smart to recurse gives the same result.

Versions Report

Salt Version:
           Salt: 2015.8.8

Dependency Versions:
         Jinja2: 2.8
       M2Crypto: Not Installed
           Mako: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.2.0
         Python: 2.7.11 (default, May  7 2016, 22:38:59)
           RAET: Not Installed
        Tornado: 4.3
            ZMQ: 4.1.4
           cffi: 1.6.0
       cherrypy: Not Installed
       dateutil: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
        libgit2: Not Installed
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.7
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: 2.6.1
         pygit2: Not Installed
   python-gnupg: Not Installed
          smmap: Not Installed
        timelib: Not Installed

System Versions:
           dist: gentoo 2.2 
        machine: x86_64
        release: 4.5.5-hardened-r1
         system: Gentoo Base System 2.2 

Activity

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

    ConfirmedSalt engineer has confirmed bug/feature - often including a MCVECorerelates to code central or existential to SaltPillarbugbroken, 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 around

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions