Discussion:
[salt-users] Why must 'saltutil.refresh_pillar' be run?
David Nelson
2016-10-26 18:35:44 UTC
Permalink
Learning Salt and trying to understand what's going with pillar data and
how things work under the covers. This is against salt-2016.3.3 if that
matters. Take the following three pillar files and examples:

top.sls:
base:
'*':
- one

one.sls:
one:
- uid: 101

two.sls:
two:
- uid: 102

Then, refresh the pillar data with 'salt minion saltutil.refresh_pillar'.


Then, check to see what pillar data the minion sees with 'salt minion
pillar.items'. I get:

minion:
----------
one:
|_
----------
uid:
101

Then update 'top.sls' but DO NOT refresh the pillar data:
base:
'*':
- one
- two


Then check the pillar items with 'salt minion pillar.items'. I get:
minion:
----------
one:
|_
----------
uid:
101
two:
|_
----------
uid:
102


But then when I try to access the individual keys within the pillar data, I
run into problems until I refresh the pillar data:
# salt 'minion' pillar.get one
minion:
|_
----------
uid:
101

# salt 'minion' pillar.get two
minion:
#

# salt 'minion' saltutil.refresh_pillar
minion:
True
#

# salt 'minion' pillar.get two
minion:
|_
----------
uid:
102
#

Why are the keys present with 'pillar.items' but not with 'pillar.get
<key>'?

Thank you
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thomas Phipps
2016-10-26 18:46:59 UTC
Permalink
pillar.items ignores the cache and fetch the pillars directly off the
master [without updating the cache either] while pillar.get uses the cache.
which is what saltutil.refresh_pillar clears and updates. a highstate also
should update the pillar cache.
Post by David Nelson
Learning Salt and trying to understand what's going with pillar data and
how things work under the covers. This is against salt-2016.3.3 if that
- one
- uid: 101
- uid: 102
Then, refresh the pillar data with 'salt minion saltutil.refresh_pillar'.
Then, check to see what pillar data the minion sees with 'salt minion
----------
|_
----------
101
- one
- two
----------
|_
----------
101
|_
----------
102
But then when I try to access the individual keys within the pillar data,
# salt 'minion' pillar.get one
|_
----------
101
# salt 'minion' pillar.get two
#
# salt 'minion' saltutil.refresh_pillar
True
#
# salt 'minion' pillar.get two
|_
----------
102
#
Why are the keys present with 'pillar.items' but not with 'pillar.get
<key>'?
Thank you
--
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
For more options, visit https://groups.google.com/d/optout.
--
Thomas Phipps
Linux/Openstack/Logstash
(702) 518-0131
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
David Nelson
2016-10-26 19:42:53 UTC
Permalink
Aha....thank you!
Post by Thomas Phipps
pillar.items ignores the cache and fetch the pillars directly off the
master [without updating the cache either] while pillar.get uses the cache.
which is what saltutil.refresh_pillar clears and updates. a highstate also
should update the pillar cache.
Post by David Nelson
Learning Salt and trying to understand what's going with pillar data and
how things work under the covers. This is against salt-2016.3.3 if that
- one
- uid: 101
- uid: 102
Then, refresh the pillar data with 'salt minion saltutil.refresh_pillar'.
Then, check to see what pillar data the minion sees with 'salt minion
----------
|_
----------
101
- one
- two
----------
|_
----------
101
|_
----------
102
But then when I try to access the individual keys within the pillar data,
# salt 'minion' pillar.get one
|_
----------
101
# salt 'minion' pillar.get two
#
# salt 'minion' saltutil.refresh_pillar
True
#
# salt 'minion' pillar.get two
|_
----------
102
#
Why are the keys present with 'pillar.items' but not with 'pillar.get
<key>'?
Thank you
--
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
For more options, visit https://groups.google.com/d/optout.
--
Thomas Phipps
Linux/Openstack/Logstash
(702) 518-0131
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
saltycdr
2016-10-27 13:07:08 UTC
Permalink
Hi David,


I sorta ran into the same issue and decided to use a schedule on the
minions, defined in pillar;

```
schedule:
refresh_pillar:
enabled: True
maxrunning: 1
function: saltutil.refresh_pillar
seconds: 7200
splay: 45
```
Post by David Nelson
Aha....thank you!
Post by Thomas Phipps
pillar.items ignores the cache and fetch the pillars directly off the
master [without updating the cache either] while pillar.get uses the cache.
which is what saltutil.refresh_pillar clears and updates. a highstate also
should update the pillar cache.
Post by David Nelson
Learning Salt and trying to understand what's going with pillar data and
how things work under the covers. This is against salt-2016.3.3 if that
- one
- uid: 101
- uid: 102
Then, refresh the pillar data with 'salt minion saltutil.refresh_pillar'.
Then, check to see what pillar data the minion sees with 'salt minion
----------
|_
----------
101
- one
- two
----------
|_
----------
101
|_
----------
102
But then when I try to access the individual keys within the pillar
# salt 'minion' pillar.get one
|_
----------
101
# salt 'minion' pillar.get two
#
# salt 'minion' saltutil.refresh_pillar
True
#
# salt 'minion' pillar.get two
|_
----------
102
#
Why are the keys present with 'pillar.items' but not with 'pillar.get
<key>'?
Thank you
--
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
For more options, visit https://groups.google.com/d/optout.
--
Thomas Phipps
Linux/Openstack/Logstash
(702) 518-0131
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
David Nelson
2016-10-27 16:37:14 UTC
Permalink
Thanks for the tip. I haven't gotten into schedules yet so it's nice to
these types of examples.
Post by saltycdr
Hi David,
I sorta ran into the same issue and decided to use a schedule on the
minions, defined in pillar;
```
enabled: True
maxrunning: 1
function: saltutil.refresh_pillar
seconds: 7200
splay: 45
```
Post by David Nelson
Aha....thank you!
Post by Thomas Phipps
pillar.items ignores the cache and fetch the pillars directly off the
master [without updating the cache either] while pillar.get uses the cache.
which is what saltutil.refresh_pillar clears and updates. a highstate also
should update the pillar cache.
Post by David Nelson
Learning Salt and trying to understand what's going with pillar data
and how things work under the covers. This is against salt-2016.3.3 if
- one
- uid: 101
- uid: 102
Then, refresh the pillar data with 'salt minion
saltutil.refresh_pillar'.
Then, check to see what pillar data the minion sees with 'salt minion
----------
|_
----------
101
- one
- two
----------
|_
----------
101
|_
----------
102
But then when I try to access the individual keys within the pillar
# salt 'minion' pillar.get one
|_
----------
101
# salt 'minion' pillar.get two
#
# salt 'minion' saltutil.refresh_pillar
True
#
# salt 'minion' pillar.get two
|_
----------
102
#
Why are the keys present with 'pillar.items' but not with 'pillar.get
<key>'?
Thank you
--
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
For more options, visit https://groups.google.com/d/optout.
--
Thomas Phipps
Linux/Openstack/Logstash
(702) 518-0131
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...