Open OrangeDog opened 4 years ago
@OrangeDog I'm certain that this problem actually exists in 0.21.2
as well, since absolutely nothing changed in the map to 0.21.3
-- I tested that extensively:
The issue is the upstream repo itself. 2.2
is ancient and only available for precise
and trusty
:
Try setting the pillar like this:
Let me just add, the formula definitely needs updating from 2.2
as the default. There's already an active discussion about that here: #123. Just need someone to propose an appropriate PR.
I'm certain that this problem actually exists in 0.21.2 as well
No. I just reverted back to that and the problem went away.
Try setting the pillar like this
That's exactly what I did, as I put in the report above.
@OrangeDog You've missed the lookup
from the pillar.
No I didn't.
@OrangeDog Apologies, I saw the last entry in your original report. Well, this is going to be fun to resolve, we've got the same configuration (ubuntu-1804-2019-2-py3
) working in Travis for 0.21.3
:
Hmm, I don't know what else would cause a difference, assuming your tests aren't broken in some way.
@OrangeDog We've got debug
logging active, so you can see exactly what's rendered. So the key places clearly show what's going on.
Rendered pillar data:
Various repos configured for 4.4
:
Various 4.4
packages installed:
InSpec tests passing for the specific package versions installed for 4.4
:
I also have the zabbix module properties set on this host. Maybe that messes up the merging now? They already have to use different yaml syntax.
zabbix.url: ...
zabbix.user: ...
zabbix:
lookup:
version_repo: '4.4'
@OrangeDog The one potential difference is the use of config.get
vs. pillar.get
. Can you share any differences in the output of the following:
salt <minion> pillar.get zabbix
salt <minion> config.get zabbix
On my currently working system (the psk is in a grain).
pillar.get:
{
"local": {
"lookup": {
"version_repo": "4.4"
}
}
}
config.get:
{
"local": {
"psk": "..."
}
}
@OrangeDog Back when we first started using config.get
, there was a question about the merge strategy to use. We did consider allowing that to be configurable (see the Jinja snippet in this comment). Would you mind testing the following change:
-{%- set _config = salt['config.get']('zabbix', default={}) %}
+{%- set _config = salt['config.get']('zabbix', default={}, merge='recurse')
Using that commit hasn't had any apparent effect: the state still tries to use the 2.2 repo.
@OrangeDog So is there any difference between the output of these two commands?
salt <minion> config.get zabbix
salt <minion> config.get zabbix merge=recurse
If not, would you mind sharing the layout of how you're providing that grain, so that I can test it at my end?
With merge=recurse
, it includes the "lookup": {"version_repo": "4.4"}
.
The grain is set via the jinja in this state:
/etc/zabbix/psk:
file.managed:
- contents:
- {{ salt['grains.get_or_set_hash']('zabbix:psk', length=64, chars='0123456789abcdef') }}
- user: {{ zabbix.user }}
- mode: 400
- watch_in:
- service: zabbix-agent
That sls also includes stuff from the formula, in case that makes a difference.
{% from "zabbix/map.jinja" import zabbix %}
include:
- zabbix.agent.conf
- zabbix.agent.repo
With
merge=recurse
, it includes the"lookup": {"version_repo": "4.4"}
.
@OrangeDog Excellent, we're on the right path then.
Using that commit hasn't had any apparent effect: the state still tries to use the 2.2 repo.
Do you mean you tried commit 8291d7c? That doesn't contain merge='recurse'
. That was to indicate the line that needs to be changed accordingly:
-{%- set _config = salt['config.get']('zabbix', default={}) %}
+{%- set _config = salt['config.get']('zabbix', default={}, merge='recurse')
Oh, yes, I configured the master to use that commit instead of a tag. You want me to pull the source and patch it instead?
Oh, yes, I configured the master to use that commit instead of a tag. You want me to pull the source and patch it instead?
Yes, please.
Looks like that fixes it.
Thanks, that answers the question about whether we need the merge
strategy to be configurable for config.get
. Now we need to figure out the right way to go about this, since we're using the (implicit) default of merge=None
across numerous formulas now. I reckon we're going to have to keep that as the default and then allow the strategy to be configured in an appropriate way.
Why can't it always be recurse?
Why can't it always be recurse?
That's what I started with when first introducing config.get
but various issues came up during discussions, including the fact that merge
wasn't working at all on salt-ssh
.
salt-ssh
At other points, there were other issues raised including:
config.get
still allows you to pick a single source, rather than just the pillarIt would be workable if it were None
(I'd just have to rename my grain), but the release notes didn't explain this (seemingly major) change.
It would be workable if it were
None
(I'd just have to rename my grain), but the release notes didn't explain this (seemingly major) change.
I'm going to send a note to the main contributors explaining that pillar.get
=> config.get
will now have to be considered a BREAKING CHANGE
, from a semantic-release
perspective. That will allow us to add the appropriate instructions that will reach the changelog.
Thanks. Also +1 to allowing a merge. I imagine many people would want to split their config, keeping secrets in pillar but moving the other bits somewhere more performant (even though I've currently got almost the opposite).
Your setup
Formula commit hash / release tag
0.21.3
Versions reports (master & minion)
Pillar / config used
Bug details
Describe the bug
Upgrading from 0.21.2 to 0.21.3 changed how the repo is configured. It's now trying to use the default, which does not exist
Steps to reproduce the bug
See above.
Expected behaviour
No changes to existing behaviour on minor/patch releases.
Attempts to fix the bug
Had a look at the code and tried this pillar instead, but it had no effect.