Relenv salt-ssh fully functional

This commit is contained in:
Tyler Levy Conde 2024-09-23 09:40:14 -06:00 committed by Daniel Wozniak
parent a74ce63e09
commit 3bf8dda2e5
3 changed files with 7 additions and 5 deletions

View file

@ -212,9 +212,8 @@ SUDO_USER="{SUDO_USER}"
if [ "$SUDO" ] && [ "$SUDO_USER" ]; then SUDO="$SUDO -u $SUDO_USER"; fi
RELENV_TAR="{THIN_DIR}/salt-relenv.tar.xz"
RELENV_DIR="{THIN_DIR}/salt"
mkdir -p "{THIN_DIR}"
SALT_CALL_BIN="$RELENV_DIR/salt-call"
SALT_CALL_BIN="{THIN_DIR}/salt-call"
# Extract relenv tarball if not already extracted
if [ ! -x "$SALT_CALL_BIN" ]; then
@ -225,7 +224,7 @@ if [ ! -x "$SALT_CALL_BIN" ]; then
fi
# Create directory if not exists and extract the tarball
tar -xf "$RELENV_TAR" -C "{THIN_DIR}"
tar --strip-components=1 -xf "$RELENV_TAR" -C "{THIN_DIR}"
fi
# Check if Python binary is executable
@ -237,7 +236,7 @@ fi
echo "{RSTR}"
echo "{RSTR}" >&2
exec $SUDO "$SALT_CALL_BIN" --retcode-passthrough --local --metadata --out=json -lquiet -c "$RELENV_DIR" {ARGS}
exec $SUDO "$SALT_CALL_BIN" --retcode-passthrough --local --metadata --out=json -lquiet -c "{THIN_DIR}" {ARGS}
EOF
""".split(
"\n"

View file

@ -72,6 +72,9 @@ def get_tarball(kernel, arch):
def download(cachedir, url, destination):
"""
Download the salt artifact from the given destination to the cache.
"""
if not os.path.exists(destination):
log.info(f"Downloading from {url} to {destination}")
try:

View file

@ -163,7 +163,7 @@ def test_thin_dir(salt_ssh_cli):
assert thin_dir.joinpath("running_data").exists()
def test_relenv(salt_ssh_cli):
def test_relenv_dir(salt_ssh_cli):
"""
test to make sure thin_dir is created
and salt-call file is included