-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[master] fix(mac_brew_pkg): Improve search for Homebrew's prefix #64924
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
salt-project-bot-prod-environment
bot
changed the title
fix(mac_brew_pkg): Guess homebrew prefix
[master] fix(mac_brew_pkg): Guess homebrew prefix
Aug 4, 2023
cdalvaro
added a commit
to cdalvaro/salt
that referenced
this pull request
Aug 5, 2023
cdalvaro
force-pushed
the
bugfix_macOS_homebrew_bin
branch
from
August 5, 2023 07:35
4332a2a
to
28d7818
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR improves the way salt tries to figure out the
brew
macOS command.What issues does this PR fix or reference?
After latest changes in brew command: Homebrew/brew#15787, Homebrew/brew#15818 and finally Homebrew/brew#15827,
salt
fails executingbrew
commands when noHOME
env variable is set with the following error:This is due because
salt-minion
is launched as a Launch Daemon in macOS with a very reduced environment:(I have added
PATH
andHOMEBREW_PREFIX
manually to my daemon's plist file)When
salt
tries to recover thebrew --prefix
with the following code:salt/salt/modules/mac_brew_pkg.py
Lines 96 to 102 in 4e8b77d
There is no
$HOME
, neither$USER
, neither$LOGNAME
in the environment.This PR tries to figure out the Homebrew's prefix, by using the
HOMEBREW_PREFIX
env variable. As it is already used in other salt modules, like inrsax931.py
:salt/salt/utils/rsax931.py
Line 41 in 4e8b77d
If the environment variable is not set, then it tries the most common paths for
brew
regarding the system architecture./opt/homebrew
for Apple Silicon (a.k.a.: arm64),/usr/local
for Intel Macs (a.k.a.: x86_64).Merge requirements satisfied?
[NOTICE] Bug fixes or features added to Salt require tests.
Commits signed with GPG?
Yes
Closes #61340