Open vanveele opened 3 years ago
Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey. Please be sure to review our Code of Conduct. Also, check out some of our community resources including:
There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar. If you have additional questions, email us at core@saltstack.com. We’re glad you’ve joined our community and look forward to doing awesome things with you!
I believe that parsing of the user-data
should be avoided. Another case when it fails is when it contains a cloud-config
yaml document (the parser tries to iterate over it and fetch each line as another metadata): https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html#user-data-cloud-init
It is worth skipping the user-data
:
--- metadata.orig.py 2024-01-15 03:12:26.307231394 +0000
+++ metadata.py 2024-01-15 02:57:37.087629576 +0000
@@ -55,6 +55,8 @@
):
return body
for line in body.split("\n"):
+ if line == "user-data":
+ continue
if line.endswith("/"):
ret[line[:-1]] = _search(prefix=os.path.join(prefix, line))
elif prefix == "latest/":```
Description of Issue
With
metadata_server_grains: true
, minion fails to fetch metadata when instance user-data is binary or gzip data. Call to salt.utils.http.query fails to decode body as unicode:A possible fix could catch the
UnicodeDecodeError
and return. eg.excerpt of DEBUG log:
Setup
metadata_server_grains: true
in/etc/salt/minion
Steps to Reproduce Issue
salt-call grains.get meta-data
also reproducible from shell:
Versions Report