Skip to content

Commit

Permalink
Add some debugging for macOS failures
Browse files Browse the repository at this point in the history
  • Loading branch information
twangboy authored and dwoz committed Oct 30, 2024
1 parent 1168334 commit 0794878
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 15 deletions.
78 changes: 65 additions & 13 deletions pkg/macos/pkg-scripts/postinstall
Original file line number Diff line number Diff line change
Expand Up @@ -86,55 +86,107 @@ fi

log "Symlink: Creating symlinks for salt..."
ln -sf "$INSTALL_DIR/salt" "$SBIN_DIR/salt"
log "Symlink: Created Successfully"
if [ -f "$SBIN_DIR/salt" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi

log "Symlink: Creating symlinks for salt-api..."
ln -sf "$INSTALL_DIR/salt-api" "$SBIN_DIR/salt-api"
log "Symlink: Created Successfully"
if [ -f "$SBIN_DIR/salt-api" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi

log "Symlink: Creating symlinks for salt-call..."
ln -sf "$INSTALL_DIR/salt-call" "$SBIN_DIR/salt-call"
log "Symlink: Created Successfully"
if [ -f "$SBIN_DIR/salt-call" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi

log "Symlink: Creating symlinks for salt-cloud..."
ln -sf "$INSTALL_DIR/salt-cloud" "$SBIN_DIR/salt-cloud"
log "Symlink: Created Successfully"
if [ -f "$SBIN_DIR/salt-cloud" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi

log "Symlink: Creating symlinks for salt-cp..."
ln -sf "$INSTALL_DIR/salt-cp" "$SBIN_DIR/salt-cp"
log "Symlink: Created Successfully"
if [ -f "$SBIN_DIR/salt-cp" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi

log "Symlink: Creating symlinks for salt-key..."
ln -sf "$INSTALL_DIR/salt-key" "$SBIN_DIR/salt-key"
log "Symlink: Created Successfully"
if [ -f "$SBIN_DIR/salt-key" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi

log "Symlink: Creating symlinks for salt-master..."
ln -sf "$INSTALL_DIR/salt-master" "$SBIN_DIR/salt-master"
log "Symlink: Created Successfully"
if [ -f "$SBIN_DIR/salt-master" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi

log "Symlink: Creating symlinks for salt-minion..."
ln -sf "$INSTALL_DIR/salt-minion" "$SBIN_DIR/salt-minion"
log "Symlink: Created Successfully"
if [ -f "$SBIN_DIR/salt-minion" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi

log "Symlink: Creating symlinks for salt-proxy..."
ln -sf "$INSTALL_DIR/salt-proxy" "$SBIN_DIR/salt-proxy"
log "Symlink: Created Successfully"
if [ -f "$SBIN_DIR/salt-proxy" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi

log "Symlink: Creating symlinks for salt-run..."
ln -sf "$INSTALL_DIR/salt-run" "$SBIN_DIR/salt-run"
log "Symlink: Created Successfully"
if [ -f "$SBIN_DIR/salt-run" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi

log "Symlink: Creating symlinks for spm..."
ln -sf "$INSTALL_DIR/spm" "$SBIN_DIR/spm"
log "Symlink: Created Successfully"
if [ -f "$SBIN_DIR/salt-spm" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi

log "Symlink: Creating symlinks for salt-ssh..."
ln -sf "$INSTALL_DIR/salt-ssh" "$SBIN_DIR/salt-ssh"
log "Symlink: Created Successfully"
if [ -f "$SBIN_DIR/salt-ssh" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi

log "Symlink: Creating symlinks for salt-syndic..."
ln -sf "$INSTALL_DIR/salt-syndic" "$SBIN_DIR/salt-syndic"
log "Symlink: Created Successfully"
if [ -f "$SBIN_DIR/salt-syndic" ]; then
log "Symlink: Created Successfully"
else
log "Symlink: Failed to create symlink"
fi

#-------------------------------------------------------------------------------
# Add salt to paths.d
Expand Down
5 changes: 3 additions & 2 deletions tests/pytests/pkg/integration/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_salt_version(version, install_salt):
actual.append(actual_ver[0])
actual.append(actual_ver_salt_stripped)
else:
pytest.skip("Not testing a non-release build artifact, do not run")
pytest.skip("We don't run this test on release builds")

expected = ["salt", version]
assert actual == expected
Expand Down Expand Up @@ -128,7 +128,6 @@ def test_compare_versions(binary, install_salt):
@pytest.mark.parametrize(
"symlink",
[
# We can't create a salt symlink because there is a salt directory
"salt",
"salt-api",
"salt-call",
Expand All @@ -149,6 +148,8 @@ def test_symlinks_created(version, symlink, install_salt):
Test symlinks created
"""
ret = install_salt.proc.run(pathlib.Path("/usr/local/sbin") / symlink, "--version")
install_log_file = pathlib.Path("/tmp") / "postinstall.txt"
install_log_content = install_log_file.read_text()
ret.stdout.matcher.fnmatch_lines([f"*{version}*"])


Expand Down

0 comments on commit 0794878

Please sign in to comment.