salt icon indicating copy to clipboard operation
salt copied to clipboard

Pillar: include item uses key from other item

Open veym4os opened this issue 7 years ago • 3 comments

Description

When using include statements with and without specified "key" property in the same file, an include without key can get the value of another include item. This happens only, if the include key is set after an include without key.

Steps to reproduce

Only pillar required:

# basic.sls
include:
  - something
  - something_else:
      key: some_key
# something.sls
something: value
# something_else.sls
something_else: other value

Expected output:

# salt-call pillar.items
local:
    ----------
    something:
        some value
    something_else:
        other value

Observed output:

# salt-call pillar.items
local:
    ----------
    some_key:
        ----------
        something:
            some value
        something_else:
            other value

I have also tried to manually overwrite the key for the first include with the following options. This had no effect:

- something:
    key: ~
---
- something: {}
---
- something:
    key: ""

Changing the input order leads to the expected result:

# basic.sls
include:
  - something_else:
      key: some_key
  - something

Versions Report

# salt --versions-report
Salt Version:
           Salt: 2019.2.0
 
Dependency Versions:
           cffi: 1.6.0
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: 0.31.0
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.5 (default, Aug  7 2019, 08:19:52)
   python-gnupg: 0.4.3
         PyYAML: 3.11
          PyZMQ: 15.3.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4
 
System Versions:
           dist: oracle 7.7 
         locale: UTF-8
        machine: x86_64
        release: 4.1.12-124.32.3.el7uek.x86_64
         system: Linux
        version: Oracle Linux Server 7.7 

veym4os avatar Oct 21 '19 07:10 veym4os

Okay so I can reproduce this, and based on the output it seems like a simple logic error when using pillar and keys. Thanks for submitting.

xeacott avatar Oct 23 '19 19:10 xeacott

Can't reproduce with

Salt Version: Salt: 3006.0

Python Version: Python: 3.6.15 (default, Sep 23 2021, 15:41:43) [GCC]

Dependency Versions: cffi: 1.13.2 cherrypy: Not Installed dateutil: Not Installed docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed Jinja2: 2.10.1 libgit2: Not Installed looseversion: 1.0.2 M2Crypto: 0.38.0 Mako: Not Installed msgpack: 0.5.6 msgpack-pure: Not Installed mysql-python: Not Installed packaging: 21.3 pycparser: 2.17 pycrypto: Not Installed pycryptodome: Not Installed pygit2: Not Installed python-gnupg: Not Installed PyYAML: 5.4.1 PyZMQ: 17.1.2 relenv: Not Installed smmap: Not Installed timelib: Not Installed Tornado: 4.5.3 ZMQ: 4.2.3

hramrach avatar Jun 10 '24 18:06 hramrach

Not reproducible on any supported branch (3006.x, 3007.x, 3008.x, master). Verified with the report's exact MCVE:

include:
  - something
  - something_else:
      key: some_key

Output on all supported branches:

{'some_key': {'something_else': 'other value'}, 'something': 'some value'}

Matches the expected behavior. Original report was against 2019.2.0 (EOL); @hramrach already confirmed non-repro on 3006.0 in a 2024 comment. Closing.

dwoz avatar Jun 29 '26 21:06 dwoz