salt-ext-modules-vmware
salt-ext-modules-vmware copied to clipboard
esxi salt-proxy fails with errors (__salt__ is not defined) causes failure
I've setup an esxi proxy using the saltext modules and it's getting constant errors per the following:
# salt-proxy --proxyid esxi_cluster1_esx01
[CRITICAL] Failed to load grains defined in grain file esxi.esxi in function <LoadedFunc name='esxi.esxi'>, error:
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/salt/loader/__init__.py", line 943, in grains
ret = funcs[key](**kwargs)
File "/usr/lib/python3.7/site-packages/salt/loader/lazy.py", line 149, in __call__
return self.loader.run(run_func, *args, **kwargs)
File "/usr/lib/python3.7/site-packages/salt/loader/lazy.py", line 1201, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/usr/lib/python3.7/site-packages/salt/loader/lazy.py", line 1216, in _run_as
return _func_or_method(*args, **kwargs)
File "/usr/lib/python3.7/site-packages/saltext/vmware/grains/esxi.py", line 37, in esxi
return _grains()
File "/usr/lib/python3.7/site-packages/saltext/vmware/grains/esxi.py", line 95, in _grains
username, password = _find_credentials(host)
File "/usr/lib/python3.7/site-packages/saltext/vmware/grains/esxi.py", line 75, in _find_credentials
ret = __salt__["vmware_info.system_info"](
NameError: name '__salt__' is not defined
In looking at other grains modules I can see them using salt but I'm guessing that the salt-proxy isn't LazyLoading modules before the grains module (just a guess) executes. If I remove the whole grains module directory
mv /usr/lib/python3.7/site-packages/saltext/vmware/grains /root
I am getting verify_ssl errors (not surprising as the hosts are using self-signed certs, which I think i just need to set the credential_store param in the esxi proxy config or set verify_ssl somewhere.
Either way, once I remove the grains module I get further. That makes a degree of sense because the esxi proxy minion offers a grains method natively, which this grains module seems to be replicating.