Skip to content
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

Loader nomerge: Don't allow modules to "merge" #20540

Closed
wants to merge 4 commits into from

Conversation

jacksontj
Copy link
Contributor

In the current loader (and previous one) you are allowed to create a module with a virtual_name which can add its functions to the namespace (within salt) of another module. This is very confusing, and inconsistent (not to mention hard to debug). From talking it out in #20481 we determined there aren't use-cases that require this functionality, so we are going to remove it and move the few cases over to decorators, load, or something similarly less-magical.

@steverweber
Copy link
Contributor

Thanks for merging the submodule support.

removing the "merge" option looks like fun.

@jfindlay
Copy link
Contributor

The intent of your patch seems to make this test invalid on purpose, right?

@jacksontj
Copy link
Contributor Author

Yes, although the last time i submitted this that one test didn't fail-- but the equivalent non-ssh one did ;)

@thatch45
Copy link
Contributor

I really dislike this PR, we have a lot of deployments that use this feature. I don't think that being confused is a valid reason here.

@jfindlay jfindlay added the Pending-Discussion The issue or pull request needs more discussion before it can be closed or merged label Feb 10, 2015
@thatch45
Copy link
Contributor

@jacksontj I will only let this in if it is config gated, this is going to break a lot of people's environments and should not be on by default

@jacksontj
Copy link
Contributor Author

@thatch45 We talked about it a lot in another PR. Its not so much a case of "im confused" its more of a case of "we can't know what its doing". From our other conversation it sounds like we agreed this would be a good feature to kill off-- which will require some time (since people could be using the feature).

From chatting in the other PR it seems that there isn't really a valid use-case that requires this complexity that couldn't be solved in a more simple way. Do you have a use-case that requires this? If not I think its a good idea to start the process of removing this feature.

@thatch45
Copy link
Contributor

Looks like we have a number of test failures here

@jacksontj
Copy link
Contributor Author

Yea, from your last comment it sounded like this was still under dispute--
although from this comment it sounds like we are okay with this.

I need to add some deprecation warnings etc. and find the few places that
still use this functionality. I'm going to get back to this after I finish
our internal 2015.2 rollout

On Tue, Feb 17, 2015 at 8:17 AM, Thomas S Hatch notifications@github.com
wrote:

Looks like we have a number of test failures here


Reply to this email directly or view it on GitHub
#20540 (comment).

@thatch45
Copy link
Contributor

Sounds good, with the deprecation warnings I am ok putting this in develop

Since now logging this, we've noticed its a bit noisy. To cut down on that I've changed the log level to debug. In addition, I changed the loader to keep a dict of mod -> error so that the caller (if so interested) can look up the error later. I switched caller and minion to use this new API. Now if you send a job to a minion witha module that isn't loaded you get a return like:

```
'mod_name'' __virtual__ returned False: <error message here>

```

Fixes saltstack#21185
…sages-- and will be useful for stopping module merging down the road
Historically we have allowed modules to rename themselves (using __virtual__) to be the same name as a module we have already loaded. What this means is you can have 2 modules which end up being "foo", and all of their functions are placed in the loader dict (__salt__, for example). This means that all functions in the loader dict with the "foo" prefix don't come from the same code and are not gauranteed to be interoperable-- which is *very* confusing. The only use-cases we've seen could easily be implemented using the depends decorator or something similar

Comes with the side-effect of increasing "miss" performance on the LazyDict
@kiorky
Copy link
Contributor

kiorky commented Mar 6, 2015

This will break #21314 in its current form.

@jacksontj
Copy link
Contributor Author

This will also break the deb apache modules. We won't be merging this for a
while. Need to put a deprecation warning and switch people over to
decorators
On Mar 6, 2015 9:14 AM, "Mathieu Le Marec - Pasquet" <
notifications@github.com> wrote:

This will break #21314
#21314 in its current form.


Reply to this email directly or view it on GitHub
#20540 (comment).

@jfindlay
Copy link
Contributor

@thatch45, @jacksontj, what think ye all about this pull request?

@thatch45
Copy link
Contributor

I am going to close this out for a while, once activity starts again we can re-open

@thatch45 thatch45 closed this Mar 27, 2015
jacksontj added a commit to jacksontj/salt that referenced this pull request Jun 19, 2015
Since we were checking if mod_init is in the loader dict-- and we still allow for module merging (saltstack#20540) we will do a load_all for every module without mod_init. This patch makes it so we load w/e module the function is in, then check if we have loaded a mod_init. This cuts out ~600ms on my local simple state.sls runs
cro pushed a commit to cro/salt that referenced this pull request Jun 23, 2015
Since we were checking if mod_init is in the loader dict-- and we still allow for module merging (saltstack#20540) we will do a load_all for every module without mod_init. This patch makes it so we load w/e module the function is in, then check if we have loaded a mod_init. This cuts out ~600ms on my local simple state.sls runs
cro pushed a commit to cro/salt that referenced this pull request Jun 23, 2015
Since we were checking if mod_init is in the loader dict-- and we still allow for module merging (saltstack#20540) we will do a load_all for every module without mod_init. This patch makes it so we load w/e module the function is in, then check if we have loaded a mod_init. This cuts out ~600ms on my local simple state.sls runs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pending-Discussion The issue or pull request needs more discussion before it can be closed or merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants