salt: grains.get_or_set_hash broken for multiple entries under the same key

I haven’t quite figured out the circumstances that make this break, but hopefully this will provide some insight. It seems to be related to calling grains.get_or_set_hash('a:a') and grains.get_or_set_hash('a:b') in the same run.

First example state file:

test:
  w.p:
    - test1: '{{ salt['grains.get_or_set_hash']('test:test1') }}'

produces the expected result from show_sls:

local:
    ----------
    test:
        ----------
        __env__:
            base
        __sls__:
            test1
        w:
            ----------
            - test1:
                y0m_e0f%
            - p
            ----------
            - order:
                10000

and /etc/salt/grains contains

test:
  test1: y0m_e0f%

Changing the state file to:

test:
  w.p:
    - test1: '{{ salt['grains.get_or_set_hash']('test:test1') }}'
    - test2: '{{ salt['grains.get_or_set_hash']('test:test2') }}'

and show_sls produces:

local:
    - Rendering SLS test1 failed, render error: while parsing a block mapping
    -   in "<unicode string>", line 4, column 7:
    -         - test2: '{'test2': 'd@nw6dd^'}'

/etc/salt/grains now contains only

test:
  test2: d@nw6dd^

Note that test:test1 is missing, despite being there in the previous run.

This is with the Ubuntu package of 2014.1.10 (2014.1.10+ds-1trusty1).

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 28 (9 by maintainers)

Commits related to this issue

Most upvoted comments

… like maznu run into this problem with actual 2019.5.20. And gratulations afterwards to getting already 5 years old for this bug 😉

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

Still present in 2019.2.0.