All of Salt's loaders now accept loaded_base_name & Only functions defined on the modules being loaded will be added to the lazy loader#62189
Conversation
123b47e to
0be65f0
Compare
|
re-run full all |
5e6bb1e to
94e39ea
Compare
There was a problem hiding this comment.
Just a couple of questions here - The one yaml -> yamldumper is probably a blocker. I think the others are more just questions on my part. I'm not sure if there's a rush to get this in -- if so it's probably fine to merge before I get back & can re-review. Otherwise, I would like to bang on it a little more, just to make sure I really understand what the impact is for the LazyLoader 🤔 (I mean, I don't see anything else that's giving me cause for concern - just the fact that we're making the change for the Loader that affects all of salt)
salt/modules/boto_cloudfront.py
Outdated
There was a problem hiding this comment.
question do all these need to be changed?
✦2 ❯ ag '"yaml\.' salt
salt/modules/boto_iam.py
1682: return __utils__["yaml.safe_dump"](results, default_flow_style=False, indent=2)
1728: return __utils__["yaml.safe_dump"](results, default_flow_style=False, indent=2)
I'm assuming that this only applies for __utils__ and not __serializers__ - I just went and found a couple of those, specifically in salt/states/file.py - it looks for serialzer_name in serializers where yaml.serialize is what's called, which doesn't look like the yamldumper 🤔
There was a problem hiding this comment.
The yamldumper only applies to the utils dunder.
They were never using our yamldumper utils module, they were using the actual yaml package.
There was a problem hiding this comment.
question if I do git checkout salt/master -- salt/loader/lazy.py then this doesn't fail 🤔 It only fails if I leave lazy as-is and change this back. Why is that?
There was a problem hiding this comment.
Because now the loader, correctly, only adds functions defined in the module, not functions imported into the module, unless these are namespaced into the module scope.
There was a problem hiding this comment.
question if I do git checkout salt/master -- salt/loader/lazy.py then this doesn't fail 🤔 It only fails if I leave lazy as-is and change this back. Why is that?
The rush is to get it into 3005. |
|
To complement, the lazy loader, prior to these changes loaded every function or partial it could get its hands on, namely due to the loader doing a This is the wrong behavior because the loader should only care about functions defined on the module being loaded. If we did On some rare occasions, that is the intended behavior, and thats why the |
|
However, we were failing to enforce these constraints. |
|
This is why we should never allowed Which goes against how the LazyLoader was intended to work. |
Fixes saltstack#62186 Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
Fixes saltstack#62190 Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
94e39ea to
41102c9
Compare
Hi! I'm your friendly PR bot!You might be wondering what I'm doing commenting here on your PR. Yes, as a matter of fact, I am... I'm just here to help us improve the documentation. I can't respond to Okay... so what do you do? I detect modules that are missing docstrings or "CLI Example" on existing docstrings! So what does that have to do with my PR? I noticed that in this PR there are some files changed that have some of these Okay, what are they? Well, my favorite, is that since you were making changes here I'm hoping that If I can, then what? Well, you can either add them to this PR or add them to another PR. Either way is fine! Well... what if I can't, or don't want to? That's also fine! We appreciate all contributions to the Salt Project. If you Whatever approach you decide to take, just drop a comment here letting us know! Detected Issues (click me)Check Known Missing Docstrings...........................................Failed - hook id: invoke - duration: 1.06s - exit code: 1 Thanks again! |
41102c9 to
6a7e599
Compare
|
The |
…funcs in ``__utils__`` !@#$%@!#@$%!$@#$T Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
6a7e599 to
ab42a89
Compare
twangboy
left a comment
There was a problem hiding this comment.
Shouldn't we add some documentation about the loaded_base_name option in the salt/loader/__init__.py file? We mention it in the changelog, but I think it should be documented in the __init__.py where that is being added as an additional option.
Can I do it on a follow up PR if @waynew approves this one? I'll do it right after merge. |
|
@waynew when you get time to re-review this, Pedro will do a follow up PR if you see any more issues. |
loaded_base_nameas a keyword argument, allowing different namespacing the loaded modules.Fixes #62186
Fixes #62190