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
We tried to use the SDK (v8.0.3.0) in a runner in SaltStack, but always just got an error message.
Error message: ModuleNotFoundError: No module named 'vmware.vapi'; 'vmware' is not a package
It turned out that the __init__.py is missing in the vmware-vcenter package.
I could fix it by just adding a blank __init__.py to /opt/saltstack/salt/extras-3.10/vmware/__init__.py.
In older versions of the SDK the __init__.py exists and the error doesn't appear.
Reproduction steps
Install SaltStack (in our case version 3006.8)
Write a runner module for SaltStack and try to import anything from vmware (like from vmware.vapi.vsphere.client import VsphereClient)
Try to execute the runner (e.g. salt-run mymodule.myfunction)
Expected behavior
The runner can import the external module.
Additional context
No response
The text was updated successfully, but these errors were encountered:
This seems like a namespace packaging issue - different/incompatible namespace packaging strategies are utilized for a single split package - "vmware". With the new version of the SDK the new implicit namespace packaging strategy is introduced (therefore, the missing init.py file) and, I strongly believe, that in the SaltStack there is an existing part of the "vmware" package, which is utilizing another namespace packaging strategy. As a result, python's importlib does not know how to find and load packages from the multiple "vmware" package occurences.
The fact that SaltStack is a vmware product further affirms this hypothesis (it is likely that they have some "vmware" package installed).
Is it possible to inspect the python dependencies in the SaltStack runner and see whether a "vmware" package is already present? If it is, what is the utilized namespace packaging strategy (this can be determined by the contents of an init.py file)?
Describe the bug
We tried to use the SDK (v8.0.3.0) in a runner in SaltStack, but always just got an error message.
Error message:
ModuleNotFoundError: No module named 'vmware.vapi'; 'vmware' is not a package
It turned out that the
__init__.py
is missing in thevmware-vcenter
package.I could fix it by just adding a blank
__init__.py
to/opt/saltstack/salt/extras-3.10/vmware/__init__.py
.In older versions of the SDK the
__init__.py
exists and the error doesn't appear.Reproduction steps
vmware
(likefrom vmware.vapi.vsphere.client import VsphereClient
)salt-run mymodule.myfunction
)Expected behavior
The runner can import the external module.
Additional context
No response
The text was updated successfully, but these errors were encountered: