You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Extension modules not available through the salt.cmd runner #41024
$ sudo salt edge01.bjm01 transit.test
edge01.bjm01:
True
(edge01.bjm01 is a proxy minion).
I am running 2016.11.4:
Salt Version:
Salt: 2016.11.4Dependency Versions:
cffi: 1.9.1cherrypy: unknowndateutil: 2.2docker-py: Not Installedgitdb: Not Installedgitpython: Not Installedioflo: Not InstalledJinja2: 2.9.6libgit2: Not Installedlibnacl: Not InstalledM2Crypto: Not InstalledMako: Not Installedmsgpack-pure: Not Installedmsgpack-python: 0.4.2mysql-python: Not Installedpycparser: 2.17pycrypto: 2.6.1pycryptodome: Not Installedpygit2: Not InstalledPython: 2.7.9 (default, Mar 1 2015, 12:57:24)python-gnupg: Not InstalledPyYAML: 3.12PyZMQ: 14.4.0RAET: Not Installedsmmap: Not Installedtimelib: Not InstalledTornado: 4.2.1ZMQ: 4.0.5System Versions:
dist: debian 8.4machine: x86_64release: 4.4.17-cloudflaresystem: Linuxversion: debian 8.4
Have you run salt-run saltutil.sync_modules on the master?
I can't think of a reason that it wouldn't have loaded unless they aren't synced. The minion_mods is used to load them in the salt.cmd runner module, which does use _module_dirs, and loads all the extmod locations on the master.
Did you try with a proxy minion by any chance @gtmanfred? It may be related -- the proxy minions seem to have a very bizarre behaviour when it comes to extension modules caching.
For example, sometimes the modules simply disappear: #35443
salt-run is meant to be run on the master? Also, i don't see modules.transit transferred in your sync_modules, does one of those modules have the __virtualname__ transit? Or is this module still in /etc/salt/proxy-modules?
If you move it to salt://_modules and sync it down does the error go away?
I am wondering now if this is just a problem with the module_dirs setting?
So, the __proxyenabled__ key is only used by the proxy minion, and it is in modules like test.ping So if we see the proxyenabled string, we cannot be certain that we shouldn't load those modules on regular minions.
I think we could possibly add another dunder variable that says to only load modules if the minion is a proxy minion.
My current opinion is to deprecate the __proxyenabled__ directive, as it has caused no end of trouble--at one point it prevented all state modules from loading for proxy minions.
I think I'd prefer to get rid of __proxyenabled__ and replace it with the variable gtmanfred suggests (__proxyonly__? __load_on_proxy_only__?)--that variable would prevent certain modules from loading on regular minions and only load them on proxies.
In principle any sounds equally good to me, perhaps __proxyonly__ may be more appropriate.
The problem in that case was that my module was not available on the master. What would be the behaviour in that case? When __proxyonly__ = True, would that module be available only on the proxies and also on the master?
I think that the problem is that proxyonly would only load if salt.utils.is_proxy returns True which would be false for the master.
What we could do is create something that uses the raw_mod from the loader, and ignores __virtual__ and runs the module no matter what virtual returns.
Forgot to reply here.
This sounds good to me, but it may not work well with modules requiring a third party lib.
There aren't so many modules though and we can maybe just change the code to 'proxy' in __opts__ or __opts__['__role'] == 'master' for those that make sense (for some modules it wouldn't make sense).
What do you think?
Activity
gtmanfred commentedon May 3, 2017
Have you run
salt-run saltutil.sync_moduleson the master?I can't think of a reason that it wouldn't have loaded unless they aren't synced. The minion_mods is used to load them in the salt.cmd runner module, which does use _module_dirs, and loads all the extmod locations on the master.
Thanks,
Daniel
mirceaulinic commentedon May 3, 2017
Yes, @gtmanfred I did run:
However, the request still fails:
gtmanfred commentedon May 3, 2017
Hrm, that is odd, gimme a bit and I will try and replicate this on my end.
Thanks,
Daniel
gtmanfred commentedon May 3, 2017
I am able to replicate the error, but as soon as I sync modules it works.
mirceaulinic commentedon May 4, 2017
Did you try with a proxy minion by any chance @gtmanfred? It may be related -- the proxy minions seem to have a very bizarre behaviour when it comes to extension modules caching.
For example, sometimes the modules simply disappear: #35443
gtmanfred commentedon May 5, 2017
salt-run is meant to be run on the master? Also, i don't see
modules.transittransferred in your sync_modules, does one of those modules have the__virtualname__transit? Or is this module still in /etc/salt/proxy-modules?If you move it to salt://_modules and sync it down does the error go away?
I am wondering now if this is just a problem with the
module_dirssetting?Thanks,
Daniel
mirceaulinic commentedon May 5, 2017
I think it was already cached. For example, if I run it right now, the output is:
It is under salt://_modules, synced and available to run on the CLI.
Applying a change inside the module and resync:
This is the virtualname:
However, the
__virtual__fun was:Which made the module unavailable as the proxy key does not exist on the master, but only on the proxy minion level.
After changing the
__virtual__function to:I am able to run
$ sudo salt-run salt.cmd transit.pingwithout any issues.I am happy to close this ticket, but do you think there's any workaround, as there are many modules testing against the proxy key inside the
__opts__? As a side note, the documentation recommends this: https://docs.saltstack.com/en/latest/topics/proxyminion/index.html#the-proxyenabled-directive. In other words I am just wondering if there would be possible to gate a way (hack?) for modules having this test, rather than updating each and every module.Thanks,
-Mircea
gtmanfred commentedon May 5, 2017
So, the
__proxyenabled__key is only used by the proxy minion, and it is in modules liketest.pingSo if we see the proxyenabled string, we cannot be certain that we shouldn't load those modules on regular minions.I think we could possibly add another dunder variable that says to only load modules if the minion is a proxy minion.
@cro do you have an opinion about this?
Thanks,
Daniel
cro commentedon May 5, 2017
My current opinion is to deprecate the
__proxyenabled__directive, as it has caused no end of trouble--at one point it prevented all state modules from loading for proxy minions.I think I'd prefer to get rid of
__proxyenabled__and replace it with the variable gtmanfred suggests (__proxyonly__?__load_on_proxy_only__?)--that variable would prevent certain modules from loading on regular minions and only load them on proxies.mirceaulinic commentedon May 13, 2017
In principle any sounds equally good to me, perhaps
__proxyonly__may be more appropriate.The problem in that case was that my module was not available on the master. What would be the behaviour in that case? When
__proxyonly__ = True, would that module be available only on the proxies and also on the master?gtmanfred commentedon May 15, 2017
I think that the problem is that proxyonly would only load if salt.utils.is_proxy returns True which would be false for the master.
What we could do is create something that uses the raw_mod from the loader, and ignores
__virtual__and runs the module no matter what virtual returns.https://docs.saltstack.com/en/latest/ref/clients/#salt.loader.raw_mod
And expose that in the salt runner.
mirceaulinic commentedon May 22, 2017
Forgot to reply here.
This sounds good to me, but it may not work well with modules requiring a third party lib.
There aren't so many modules though and we can maybe just change the code to
'proxy' in __opts__ or __opts__['__role'] == 'master'for those that make sense (for some modules it wouldn't make sense).What do you think?
gtmanfred commentedon May 22, 2017
mirceaulinic commentedon May 26, 2017
As this makes sense to everyone involved in this thread, I am going to close this issue. Thanks, @gtmanfred @cro