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

[BUG] Salt Extensions Installed to Extras Location Are Not Accessible #64192

Closed
garethgreenaway opened this issue Apr 29, 2023 · 2 comments · Fixed by #64212
Closed

[BUG] Salt Extensions Installed to Extras Location Are Not Accessible #64192

garethgreenaway opened this issue Apr 29, 2023 · 2 comments · Fixed by #64212
Assignees
Labels
Bug broken, incorrect, or confusing behavior Sulfur v3006.1

Comments

@garethgreenaway
Copy link
Contributor

Description
Beginning in 3006.0, any Salt extensions that are installed via PIP that are installed to the onedir extras directory are not accessible by Salt

Steps to Reproduce the behavior
Install a Salt extension via PIP that will be installed to the onedir extras directory

Expected behavior
Salt extension should be accessible.

@garethgreenaway garethgreenaway added Bug broken, incorrect, or confusing behavior needs-triage Sulfur v3006.1 and removed needs-triage labels Apr 29, 2023
@garethgreenaway garethgreenaway added this to the Sulfur v3006.1 milestone Apr 29, 2023
@Ch3LL
Copy link
Contributor

Ch3LL commented May 2, 2023

This is also impacting any libraries installed to the extras directory. For example if using salt-pip to install heist-salt:

(heist-3.8)  ch3ll@megan-precision5550  ~/onedir  ./salt/extras-3.10/bin/heist --version
./salt/extras-3.10/bin/heist: line 3: /home/ch3ll/onedir/salt/extras-3.10/bin/python3: No such file or directory

If I update the heist file to directly point to ./salt/bin/python3:

#!/bin/sh
"true" ''''
"exec" "/home/ch3ll/onedir/salt/bin/python3" "$0" "$@"
'''
# -*- coding: utf-8 -*-
import re
import sys
from distro.distro import main
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(main())

I get this error:

(heist-3.8)  ch3ll@megan-precision5550  ~/onedir/salt  ./extras-3.10/bin/heist --version
Traceback (most recent call last):
  File "/home/ch3ll/onedir/salt/./extras-3.10/bin/heist", line 8, in <module>
    from heist.scripts import start
ModuleNotFoundError: No module named 'heist'

This is because the extras directory is not in the sys.path:

(heist-3.8)  ch3ll@megan-precision5550  ~/onedir/salt  ./bin/python3
Python 3.10.11 (main, Apr 14 2023, 05:57:16) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/home/ch3ll/onedir/salt/lib/python310.zip', '/home/ch3ll/onedir/salt/lib/python3.10', '/home/ch3ll/onedir/salt/lib/python3.10/lib-dynload', '/home/ch3ll/onedir/salt/lib/python3.10/site-packages']
>>> 
(heist-3.8)  ch3ll@megan-precision5550  ~/onedir/salt  ./bin/python3
Python 3.10.11 (main, Apr 14 2023, 05:57:16) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> import heist
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'heist'
>>> sys.path.append('/home/ch3ll/onedir/salt/extras-3.10')
>>> import heist  

I also tried the same thing with the distro package in extras

@s0undt3ch s0undt3ch linked a pull request May 2, 2023 that will close this issue
@anilsil
Copy link

anilsil commented May 5, 2023

closing as per #64212

@anilsil anilsil closed this as completed May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Sulfur v3006.1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants