-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mine.get returns different dictionary format in version 3000 #56118
Comments
Probably introduced in #55760 CC: @github-abcde |
Where? It's not mentioned in the release notes. |
Interesting. The underscore-variables returned are for internal use only and should not be returned. The code at https://github.com/saltstack/salt/pull/55760/files#diff-b63dd508d9b7489d1f22527bda3f300dR613 detects the |
@ryanmilne-digicert Just a thought, is your salt-master running on version 3000 as well? Because if the versions are mismatched, the minion will send the new datastructure (including minion-side-acl metadata), but the master will not expect this and just return all the data the minion has provided. |
I ran into this as well - updating the master to 3000 allows the mine to display as expected. |
I just checked and my saltmaster is still on 2019.2.2. However, I am using the docker images and there does not appear to be anything newer published to docker hub. |
https://docs.saltstack.com/en/latest/topics/mine/
|
However, it looks like it is quite easy to temporarily patch an older master: diff --git a/salt/daemons/masterapi.py b/salt/daemons/masterapi.py
index 8fc5bdc0af..61067bef56 100644
--- a/salt/daemons/masterapi.py
+++ b/salt/daemons/masterapi.py
@@ -591,7 +591,10 @@ class RemoteFuncs(object):
if isinstance(fdata, dict):
fdata = fdata.get(load['fun'])
if fdata:
- ret[minion] = fdata
+ if isinstance(fdata, dict) and '__data__' in fdata:
+ ret[minion] = fdata['__data__']
+ else:
+ ret[minion] = fdata
return ret
def _mine(self, load, skip_verify=False):
diff --git a/salt/utils/minions.py b/salt/utils/minions.py
index a24f293701..21bea126e8 100644
--- a/salt/utils/minions.py
+++ b/salt/utils/minions.py
@@ -1157,5 +1157,8 @@ def mine_get(tgt, fun, tgt_type='glob', opts=None):
continue
fdata = mdata.get(fun)
if fdata:
- ret[minion] = fdata
+ if isinstance(fdata, dict) and '__data__' in fdata:
+ ret[minion] = fdata['__data__']
+ else:
+ ret[minion] = fdata
return ret |
@max-arnold is completely right that you should always upgrade your master first, so this is definitely the recommended approach. Although we do not guarantee backwards compatibility of newer minions with older masters we want to try to make a best effort to keep that compatibility. Diving in now to see if its even possible. |
It makes sense to upgrade the master first, however I ran into this as I created some new servers with Salt-Cloud and did not see that a new version of salt had been release. Another problem though is I am using the docker images on docker hub and those have not been updated for 2 months. |
For Salt Cloud it is generally a good idea to pin the salt version using |
okay i believe we only really need to set the something like this:
I confirmed that works for working with new/old versions. @github-abcde see anything wrong with this approach? I'm writing some tests right now, so i might find something wrong while i'm working on this. |
@ryanmilne-digicert let me ask around about docker-hub |
@Ch3LL Syntactically there is nothing wrong, however semantically I would prefer a different solution. With your proposed change this function's actions no longer completely match its name (since it will not always wrap the function_data). I would suggest implementing the check for |
thanks i'll take a look at that approach. don't see why that wouldn't work |
ping @github-abcde another follow up question. Can we not just remove adding I'm trying to understand the purpose behind adding this? |
@Ch3LL The added functionality of allowing minion-side ACL had a side-effect in what is stored in the salt mine. Before, only the raw data ( TL;DR: In the case that minion-side ACL is used ( |
thanks for the clarification :) |
@ryanmilne-digicert i was able to find out those containers are managed here: https://github.com/saltstack/saltdocker/ looks like there is an issue with the cron job on travis that should have automatically uploaded that to docker hub so i'll dive into that next week. |
@Ch3LL Thank you. I did find that repo and used it to create my own updated image, but I would like to switch back to official images once you have resolved the issue. |
Fix here: #56172 |
@ryanmilne-digicert fixed the cron job the new tag should be up: https://hub.docker.com/r/saltstack/salt/tags feel free to open a new issue if you find any issues with the container. thanks |
Thanks, Ch3LL |
Looks like I was just bitten by this. Master running 3000, monitoring node running 3000, half a dozen on 3000 as well, about a dozen on 2019.2, a handful of older.
results in
(edit: cleaned up whitespace in log output) |
Mine data gotten using
|
I created couple new servers today and noticed that the output of the mine function I use for getting the ip address of the minion is returning in a different format. I can find documentation about the change in format for defining a mine function, but nothing noting the difference in output.
Am I overlooking something?
Set
mine function definition (via pillar):
command to get mine data:
expected output:
received output:
When used in a jinja template I receive an error that there is not an element 0
Versions Report
The text was updated successfully, but these errors were encountered: