salt-enhancement-proposals
salt-enhancement-proposals copied to clipboard
SEP - Deprecate, and remove, the usage of the ``__utils__`` loader
Hello! Thank you for submitting a Salt Enhancement Proposal! Our process is detailed in the README.md and more about the SEP Life-cycle. An Open Core Team member will be assigned to follow up and help guide this SEP soon and you will find the this in the Community Slack channel #sep. Please be sure to review our Code of Conduct. You can also check out some of our community resources: - Community Wiki - Salt’s Contributor Guide - Join our Community Slack - IRC on LiberaChat - SaltStack YouTube channel - SaltStackInc Twitch channel
@OrangeDog Thank you for reviewing. I think I either answered in the PR or captured your questions in the latest commit.
I agree that the utils namespace is messy, and its usage is inconsistent:
find salt/ -name '*.py' -exec grep -l '__utils__\[' \{\} \; | sort -u | wc -l
159
find salt/ -name '*.py' -exec grep -l ' salt\.utils' \{\} \; | sort -u | wc -l
1101
Trying to override an utils module also leads to many problems (I've compiled a list of issues a while ago)
I believe SUSE uses custom utils in some way (e.g. in Yomi, maybe in Uyuni as well). Pinging @aplanas to review this SEP
But still, is there a cleaner way to solve the original use-case (distribute common code, or override built-in utils)? I guess shipping custom utils through salt extensions will be also broken? I've seen one in the wild https://gitlab.com/spirostack/spirofs/-/tree/master/spirofs (by @AstraLuma)
I believe SUSE uses custom utils in some way (e.g. in Yomi,
I confirm that we are using it, as a mechanism to deliver functions into the minion code that is not part of any module nor state.
I do not mind to remove __utils__, but what mechanism should I use now? For example, there are shared code that I do not want to be represented as a module. Will any Python submodule inside a salt module be recollected and send to the minion?
Many others may also be using salt://_utils/. That can't be replaced with a simple import. That code would need to be packaged and installed separately into the minion's environment.
@max-arnold, @aplanas, @OrangeDog: Thank you for your feedback.
I've added your questions and either answered them on the latest commit, or left it as an unresolved question(namely the last one from @OrangeDog).