Problem solved by manually defining ENV['HOME']
in the /usr/local/Library/brew.rb
file:
ENV['HOME'] = "/Users/quanta"
$ sudo salt '*' pkg.list_upgrades
MacBook-Pro.local:
- freetype
- imagemagick
- libpng
- mysql
- passenger
- pixman
- redis
- zeromq
but my question still stand: why can't the Salt the HOME
environment variable?
UPDATE Sun Dec 8 15:26:03 ICT 2013
Since salt-minion
is started via launchctl:
com.saltstack.minion.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.saltstack.minion</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/salt-minion</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
a question comes up to my mind: how to specify an environment variable in a launchd script? And the answer is:
EnvironmentVariables <dictionary of strings>
This optional key is used to specify additional environmental variables to be set before running the job.
so I added the following into the plist file:
<dict>
<key>HOME</key>
<string>/Users/quanta</string>
</dict>
then restarted the minion service, and now it's working fine.