Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pillar.get and defaults.get return null with nested dicts #52690

Closed
MikeC-BC opened this issue Apr 25, 2019 · 4 comments
Closed

pillar.get and defaults.get return null with nested dicts #52690

MikeC-BC opened this issue Apr 25, 2019 · 4 comments
Labels
cannot-reproduce cannot be replicated with info/context provided info-needed waiting for more info stale
Milestone

Comments

@MikeC-BC
Copy link

Description of Issue/Question

When attempting to use {{ salt['defaults.get']('rippled:version') }} or {{ salt['pillar.get']('rippled:config:version') }}, the value is null.

I can access the value in the CLI with pillar.get but not with defaults.get so the behavior seems different.
Works fine for non-nested dicts.

Setup

scenario 1
.sls file

rippled:
  config:
    version: 1.2.2
tags:
    - {{ salt['pillar.get']('rippled:config:version') }}

scenario 2
defaults.yaml

rippled:
  version: 1.2.2
tags:
  - {{ salt['defaults.get']('rippled:version') }}

Steps to Reproduce Issue

scenario 1

salt-call pillar.get rippled:config:version
local:
    1.2.2

Resulting file:

"tags": [
  null

scenario 2

salt-call defaults.get rippled
local:
    ----------
    rippled:
        ----------
        config:
            ----------
        hash:
            5zf863d39b135dce1e3a15e1b62e096df03de5c7a0e3a4b879f02b7207cf0c04
        service:
            False
        version:
            1.2.2

however nested value actually returns null (different than with pillar.get)

salt-call defaults.get rippled:version
local:

Resulting file:

"tags": [
  null

Versions Report

Minion:

Salt --versions-report
Salt Version:
           Salt: 2018.3.3

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.9.4
        libgit2: Not Installed
        libnacl: 1.6.1
       M2Crypto: 0.24.0
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.13 (default, Sep 26 2018, 18:42:22)
   python-gnupg: Not Installed
         PyYAML: 3.12
          PyZMQ: 16.0.2
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.4.3
            ZMQ: 4.2.1

System Versions:
           dist: debian 9.8
         locale: UTF-8
        machine: x86_64
        release: 4.9.0-8-amd64
         system: Linux
        version: debian 9.8

Master:

Salt Version:
           Salt: 2018.3.3

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.5.3
      docker-py: Not Installed
          gitdb: 2.0.0
      gitpython: 2.1.1
          ioflo: Not Installed
         Jinja2: 2.9.4
        libgit2: Not Installed
        libnacl: 1.6.1
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.13 (default, Sep 26 2018, 18:42:22)
   python-gnupg: Not Installed
         PyYAML: 3.12
          PyZMQ: 16.0.2
           RAET: Not Installed
          smmap: 2.0.1
        timelib: Not Installed
        Tornado: 4.4.3
            ZMQ: 4.2.1

System Versions:
           dist: debian 9.3
         locale: UTF-8
        machine: x86_64
        release: 4.9.0-5-amd64
         system: Linux
        version: debian 9.3
@Ch3LL
Copy link
Contributor

Ch3LL commented Apr 26, 2019

im having a hard time replicate this. Can you include the filenames and more context in the files to help replicate this.

@Ch3LL Ch3LL added cannot-reproduce cannot be replicated with info/context provided info-needed waiting for more info labels Apr 26, 2019
@Ch3LL Ch3LL added this to the Blocked milestone Apr 26, 2019
@r3lik
Copy link

r3lik commented Jun 18, 2019

I think this issue is related to this one here regarding referencing existing pillars in new pillars:
#51360

@MikeC-BC
Copy link
Author

I was able to get the desired behavior, but I don't understand the logic behind it.
My defaults is in salt/formulas/rippled/defaults.yaml


local:
    ----------
    rippled:
        ----------
        config:
            ----------
        hash:
            52fb63d98b1355ce1e3a15e1b62e096df03de5c7a0e3a4b879f02b7207cf0a19
        service:
            False
        version:
            1.2.2

Doesn't work:

dev|root@mike-test-versions-map-jinja:/srv$ salt-call defaults.get rippled:version

local:

Works:

dev|root@mike-test-versions-map-jinja:/srv$ salt-call defaults.get rippled:rippled:version

local:
    1.2.2

@stale
Copy link

stale bot commented Jan 8, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

@stale stale bot added the stale label Jan 8, 2020
@stale stale bot closed this as completed Jan 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cannot-reproduce cannot be replicated with info/context provided info-needed waiting for more info stale
Projects
None yet
Development

No branches or pull requests

3 participants