Closed alfredopalhares closed 6 years ago
That versions-report stacktrace is weird. How did you install the master? Seems like we should get that resolved, because you may have something weird going on with your install.
The
sensu["name"]
andsensu["address"]
do not get set when using salt from a salt-master. While testing with salt-call and kitchen-salt they get they proper value just fine.
Do the rest of the values get set correctly? As in, are those the only things missing, but the rest of sensu
is there?
when using salt from a salt-master
Can you clarify? What are you doing differently? The map should still execute on the minion side as part of a state run or whatever.
@baseapi I installed salt-master with the salt-bootstrap script then just apt-get install salt-master
Do the rest of the values get set correctly? As in, are those the only things missing, but the rest of sensu is there?
Yes, these are the only 2 values that do not work for some reason.
Can you clarify? What are you doing differently? The map should still execute on the minion side as part of a state run or whatever.
salt "mynodename" state.sls sensu.client
After more experimentation. I think there is some pillar data problem that is overriding the features some.
I am using yamlex to merge some pillar data after a few tries I am seeing what the problem seems to reside. Here are some example of the files:
Client state:
#!yamlex
sensu:
client:
subscriptions: !aggregate
- all
rabbitmq:
host: "123.456.789.123"
password: "password"
port: 5672
user: "user"
vhost: "/vhost"
This pillar data would be present on all minions.
The are groups like so:
#!yamlex
sensu:
client:
subscriptions: !aggregate
- mygroup
On the pillar/top.sls
file a node can have as many groups at it desires.
"mynode*":
- sensu/groups/mygroup1
- sensu/groups/mygroup2
Different behaviour occurs on the following situations:
pillar-source-merging-strategy
set to smart
Only the last of the subscriptions
value of the array stay on the node. both sensu["name"] and sensu["address] do not get properly set. The files all heave the #!yamlex
shebang on the toppillar-source-merging-strategy
set to aggregate
The subscriptions get the proper array values, name
and address
do not get set, also the rabbitmq values used and the default on the sensu-formula, this latest event does not happen when the merge strategy is set to smart.pillar-source-merging-strategy
set to aggregate
This time the name
and address
values get properly set, the subscriptions
array get only the values from that file (as its supposed to be). But the rabbitmq value does not get properly set.Hrm, I don't know yamlex well enough to know whether there's a bug here or not off the top of my head. But thanks for your good detective work, at least we'll know where to look when we find time to dive into this one.
ping
I have to admit this is not very high priority for us at the moment, @masterkorp. Not very many users are trying to do complex merging with yamlex like this, and we have a lot of bugs which are affecting many users. Just wanted to manage expectations. Sorry for the inconvenience this is causing.
@basepi Thanks for the explanation.
I don't mind getting my hands on this. If I can get some guidance on the problem.
There's a number of places where the merging happens, like this one: https://github.com/saltstack/salt/blob/develop/salt/pillar/__init__.py#L445-L449
It's possible we need a new merging strategy or something. The fix may be in the file I linked above or in https://github.com/saltstack/salt/blob/develop/salt/utils/dictupdate.py
@basepi @masterkorp
I just tested out the following additions to dictupdate.py
in order to merge lists in the update function. Seemed to work for me for merging lists of sensu subscriptions between different pillar files.
I am not using the yamlex renderer, but defaulting to smart renderer and this test worked out fine. Thoughts? Worth a PR?
def update(dest, upd):
for key, val in six.iteritems(upd):
try:
if isinstance(val, OrderedDict):
klass = OrderedDict
elif isinstance(val, list):
klass = list
else:
klass = dict
dest_subkey = dest.get(key, klass())
except AttributeError:
dest_subkey = None
if isinstance(dest_subkey, collections.Mapping) \
and isinstance(val, collections.Mapping):
ret = update(dest_subkey, val)
dest[key] = ret
elif isinstance(dest_subkey, list) \
and isinstance(val, list):
dest[key] = dest.get(key, []) + val
elif key:
dest[key] = upd[key]
return dest
:+1: Will test this soon!
@masterkorp - let me know if it works, and i'll put in a PR. I ran into the same issue trying to merge subscription lists for sensu amongst different pillars as I wanted my pillars to be "modular" when including different subscriptions for different host roles.
@masterkorp - I finally got around to making a PR for this.
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.
I have the following map.jinja on a formula
The
sensu["name"]
andsensu["address"]
do not get set when using salt from a salt-master. While testing with salt-call and kitchen-salt they get they proper value just fine.Both on the salt masterless, the minions and the master are on
Helium
above go the detailed versions-report Test box: Always built from scratchThe minions:
The master: --versions-report is breaking