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

Missing __init__.py in v8.0.3.0 #426

Open
hupebln opened this issue Jul 26, 2024 · 2 comments
Open

Missing __init__.py in v8.0.3.0 #426

hupebln opened this issue Jul 26, 2024 · 2 comments
Labels

Comments

@hupebln
Copy link

hupebln commented Jul 26, 2024

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 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

  1. Install SaltStack (in our case version 3006.8)
  2. Write a runner module for SaltStack and try to import anything from vmware (like from vmware.vapi.vsphere.client import VsphereClient)
  3. Try to execute the runner (e.g. salt-run mymodule.myfunction)

Expected behavior

The runner can import the external module.

Additional context

No response

@hupebln hupebln added the bug label Jul 26, 2024
@antonOO
Copy link

antonOO commented Aug 6, 2024

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)?

@kunalpmj
Copy link

@hupebln Any update on this? Were you able to find the libraries which are using vmware as an explicit package namespace?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants