FAQ
I have a small module that manipulates SSH public keys. The problem I am
having is that the pillar data gets stale and there doesn't appear to be
any way to refresh it via the module.

Currently the module calls this command to get the pillar value:

user = __salt__['pillar.get']("some_user")

That works fine and dandy. However, if I change what "some_user" pillar
value is on the master and re-run the module, it uses the stale value. The
only way I can find to get around this is to trigger a pillar refresh,
either via a highstate or a saltutil.refresh_pillar.

Now, it appears to me that I can include a saltutil function to refresh the
pillar before the function is called, but that doesn't seem to work.

I added the follow and tested it:

__salt__['saltutil.refresh_pillar']
user = __salt__['pillar.get']("some_user")

It appears to make no difference. The stale value is maintained until
either a highstate or a saltutil.refresh_pillar.

Minion is running:
            Salt: 2014.1.0
          Python: 2.6.6 (r266:84292, Nov 22 2013, 12:16:22)
          Jinja2: 2.2.1
        M2Crypto: 0.20.2
  msgpack-python: 0.1.13
    msgpack-pure: Not Installed
        pycrypto: 2.0.1
          PyYAML: 3.10
           PyZMQ: 2.2.0.1
             ZMQ: 3.2.4

Master is running:
            Salt: 2014.1.0
          Python: 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
          Jinja2: 2.2.1
        M2Crypto: 0.22
  msgpack-python: 0.4.2
    msgpack-pure: Not Installed
        pycrypto: 2.6.1
          PyYAML: 3.11
           PyZMQ: 14.3.1
             ZMQ: 4.0.4

--
Stephen Wood
www.heystephenwood.com

--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Steven Butterworth at Oct 21, 2014 at 1:06 pm

    On 14-10-11 08:40 PM, Stephen Wood wrote:
    I have a small module that manipulates SSH public keys. The problem I am
    having is that the pillar data gets stale and there doesn't appear to be
    any way to refresh it via the module.
    I added the follow and tested it:

    __salt__['saltutil.refresh_pillar']
    user = __salt__['pillar.get']("some_user")
    Given the delay in responding, I suspect that you have already solved
    this, but just in case...

    You don't appear to actually be running saltutil.refresh_pillar here,
    merely referencing it. You need to add the parentheses.

       response = __salt__['saltutil.refresh_pillar']()
       user = __salt__['pillar.get']("some_user")

    I noticed this because my Jinja templates are full of stuff like:

       {% set _p = salt['pillar.get'] %}

    where _p is a reference to the function and so can be invoked like:

       {{ _p('user') }} .


    --
    Steve Butterworth | It is difficult to get a man to understand
    something when his salary depends upon his
    not understanding it. -- Upton Sinclair
    --
    You received this message because you are subscribed to the Google Groups "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Wolodja Wentland at Oct 26, 2014 at 12:11 pm

    On Tue, Oct 21, 2014 at 09:06 -0400, Steven Butterworth wrote:
    On 14-10-11 08:40 PM, Stephen Wood wrote:
    I noticed this because my Jinja templates are full of stuff like:

    {% set _p = salt['pillar.get'] %}

    where _p is a reference to the function and so can be invoked like:

    {{ _p('user') }} .
    Oh, great! I will steal this. Thank you.
    --
    Wolodja <babilen@gmail.com>

    4096R/CAF14EFC
    081C B7CD FF04 2BA9 94EA 36B2 8B7F 7D30 CAF1 4EFC

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupsalt-users @
postedOct 12, '14 at 12:41a
activeOct 26, '14 at 12:11p
posts3
users3

People

Translate

site design / logo © 2022 Grokbase