Create pip install directory for packages (except for windows, for now) and add some test coverage for the new pip install directory

This commit is contained in:
MKLeb 2023-04-06 16:56:52 -04:00 committed by Gareth J. Greenaway
parent 405dc757b9
commit 3b49926587
4 changed files with 35 additions and 1 deletions

View file

@ -1,4 +1,4 @@
/var/cache/salt
/var/log/salt
/usr/share/fish/vendor_completions.d
/opt/saltstack/salt/pypath
/opt/saltstack/salt/extras-3.10

View file

@ -134,10 +134,15 @@ fi
# Copy salt-config from Salt Repo to /opt/salt
#-------------------------------------------------------------------------------
SALT_DIR="$BUILD_DIR/opt/salt"
SALT_EXTRAS_DIR="$BUILD_DIR/opt/salt/extras-3.10"
if ! [ -d "$SALT_DIR" ]; then
# We only need this for relenv builds
mkdir -p "$SALT_DIR"
fi
if ! [ -d "$SALT_EXTRAS_DIR" ]; then
# We only need this for relenv builds
mkdir -p "$SALT_EXTRAS_DIR"
fi
if ! [ -f "$SALT_DIR/salt-config.sh" ]; then
_msg "Staging Salt config script"
cp "$SCRIPT_DIR/scripts/salt-config.sh" "$SALT_DIR/"

View file

@ -255,6 +255,7 @@ rm -rf %{buildroot}
%{_bindir}/spm
%{_bindir}/salt-pip
/opt/saltstack/salt
/opt/saltstack/salt/extras-3.10
%dir %{_sysconfdir}/salt
%dir %{_sysconfdir}/salt/pki

View file

@ -51,6 +51,34 @@ def test_pip_install(salt_call_cli):
assert "The github execution module cannot be loaded" in use_lib.stderr
def test_pip_install(install_salt):
"""
Test salt-pip installs into the correct directory
"""
dep = "holidays"
extras_keyword = "extras"
try:
install_ret = subprocess.run(
install_salt.binary_paths["pip"] + ["install", dep],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
assert not install_ret.stderr
show_ret = subprocess.run(
install_salt.binary_paths["pip"] + ["show", dep],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
assert extras_keyword in show_ret.stderr
finally:
uninstall_ret = subprocess.run(
install_salt.binary_paths["pip"] + ["uninstall", dep],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
assert not uninstall_ret.stderr
def demote(user_uid, user_gid):
def result():
os.setgid(user_gid)