-
Notifications
You must be signed in to change notification settings - Fork 5.5k
use api recursion, json output. simplify code. #62384
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
use api recursion, json output. simplify code. #62384
Conversation
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.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great. It needs a changelog though. Could you please add one?
I am a total noobie in the saltproject space - is it as simple as just adding a file in the changelog directory? I dont have an existing issue to reference, should i create one first? |
yep, create an issue that you can reference then add a file to the changelog directory. you can see the documentation for the process at https://docs.saltproject.io/en/latest/topics/development/changelog.html#changelog looks like you might have to fix some pre-commit and lint issues as well. nothing major though. |
…into fix/simplify_gce_grains
I am unsure what the problem is with all the failed tests. Are they actual valid failures? |
so. looks like at least one change needed. metadata needs a docstring. doesn't have to be complex just describe the function. |
…into fix/simplify_gce_grains
I think we're all good, except a couple checks that require approval. Thanks! |
@jonbenning Looks like pre-commit is failing. No single-quotes... only double-quotes for strings. That includes doc strings. |
Have pushed the requested changes. Thanks! |
Congratulations on your first PR being merged! 🎉 |
What does this PR do?
This PR replaces the metadata_gce.py grain. That code was inspired by the EC2 grain, and utilized recursion, and other complex data checking to build the output dictionary. This code leverages the Google metadata service api's ability to output json natively, as well as its built in recurse parameter, resulting in vastly simpler code. It also automatically skips any potentially sensitive values like ssh keys, SA tokens, etc.
What issues does this PR fix or reference?
Fixes:
Merge requirements satisfied?
[NOTICE] Bug fixes or features added to Salt require tests.
Commits signed with GPG?
Yes/No: No
Please review Salt's Contributing Guide for best practices.
See GitHub's page on GPG signing for more information about signing commits with GPG.