Skip to content

Commit

Permalink
Relenv salt-ssh fully functional
Browse files Browse the repository at this point in the history
  • Loading branch information
Akm0d authored and dwoz committed Sep 30, 2024
1 parent a74ce63 commit 3bf8dda
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
7 changes: 3 additions & 4 deletions salt/client/ssh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,8 @@
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
Expand All @@ -225,7 +224,7 @@
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
Expand All @@ -237,7 +236,7 @@
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"
Expand Down
3 changes: 3 additions & 0 deletions salt/utils/relenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/pytests/integration/ssh/test_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3bf8dda

Please sign in to comment.