use api recursion, json output. simplify code.
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.
- [ ] Docs
- [ ] Changelog - https://docs.saltproject.io/en/master/topics/development/changelog.html
- [ ] Tests written/updated
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.
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:
- Community Wiki
- Salt’s Contributor Guide
- Join our Community Slack
- IRC on LiberaChat
- Salt Project YouTube channel
- Salt Project Twitch channel
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 [email protected]. We’re glad you’ve joined our community and look forward to doing awesome things with you!
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?
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.
I am unsure what the problem is with all the failed tests. Are they actual valid failures?
test_extension_discovery_without_reload_with_importlib_metadata_installed is failing because of an unrelated dependency upgrade, you will be fine if you merge the latest changes from master though (specifically https://github.com/saltstack/salt/commit/ef50ded44324efb531cafd3b0e95d733c08be410 https://github.com/saltstack/salt/commit/b676e6338a7c094cb3335d11f851ac0e12222017).
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.
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.
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.
@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! :tada: