remote execution fails while salt-call succeeds
I'm running Salt 0.10.5 on FreeBSD 9.0. Salt master is the host system, and minions are in jails. Both systems use the same configuration/repo for packages, but requests to run the nginx state (nginx: pkg.installed) fail from the master but succeed via salt-call from the minion. Example:
[root@starbuck ~]# cat /usr/local/etc/salt/states/nginx/init.sls nginx: pkg.installed
MINION: [root@europa ~]# salt-call state.sls nginx [INFO ] Loaded configuration file: /usr/local/etc/salt/minion [WARNING ] Both 'dmidecode' and 'lspci' failed to execute, either because they do not exist on the system of the user running this instance does not have the necessary permissions to execute them. Grains output might not be accurate. [INFO ] Executing command 'ps auxwww' in directory '/root' [WARNING ] Both 'dmidecode' and 'lspci' failed to execute, either because they do not exist on the system of the user running this instance does not have the necessary permissions to execute them. Grains output might not be accurate. [INFO ] Loading fresh modules for state activity [INFO ] Fetching file 'salt://nginx.sls' [INFO ] Fetching file 'salt://nginx/init.sls' [INFO ] Executing state pkg.installed for nginx [INFO ] Executing command 'pkg info' in directory '/root' [INFO ] No changes made for nginx [INFO ] Loading fresh modules for state activity local:
State: - pkg
Name: nginx
Function: installed
Result: True
Comment: Package nginx is already installed
Changes:
MASTER: [root@starbuck ~]# salt europa.sky.net state.sls nginx pkg: not found europa.sky.net:
State: - pkg
Name: nginx
Function: installed
Result: False
Comment: Package nginx failed to install
Changes:
Could you try restart salt_minion in the jails? Jump from old package system to pkgng little bit distasteful.
Thanks for the heads up here @cedwards, I think that we need to go over the package module for freebsd, I am actually leaning heavily towards stripping out the old pkg system into it's own module and making a single pkgng module
Thomas, I think this problem is because salt_minion inherit shell during start/restart. And we have got [t]csh as shell which is not too convenient for deamons.
Another way to deal with such problem is we must detect absolute path to binary it every module. For example git and svn modules have the same problem now.
Thomas, could you please revise https://github.com/giantlock/salt/commit/66ef76e72f237d8f5db3f677366e8fe5d9fc4c80 commit?
@giantlock, this looks good, were you able to reproduce the problem and get this to fix it? It does look like the right way to go
I've tried applying that patch and I still see the issue. What more information can I give or gather?
if it is a default path issue, then this patch will not work, since the which command looks for the default path. Do we need to set a default path?
@cedwards, could you show output salt europa.sky.net grains.item shell, salt europa.sky.net grains.item path and salt europa.sky.net cmd.run env?
[root@starbuck ~]# salt europa.sky.net grains.item shell europa.sky.net: /bin/sh
[root@starbuck ~]# salt europa.sky.net grains.item path europa.sky.net: /sbin:/bin:/usr/sbin:/usr/bin
[root@starbuck ~]# salt europa.sky.net cmd.run env
europa.sky.net: PATH=/sbin:/bin:/usr/sbin:/usr/bin
europa.sky.net: PWD=/
europa.sky.net: HOME=/
europa.sky.net: RC_PID=21958
europa.sky.net: PYTHON_EGG_CACHE=/tmp
@cedwards , could you try to set up appropriate PATH?
I think issue will be solved by add
salt_minion_paths="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
in /etc/rc.conf in jail and my patch.
I've added salt_minion_paths to rc.conf and it seems to work. I can now run salt $minion state.sls nginx and it does what I expect.
I will update the pkg-message.in in the port to include this information.
Good idea, thanks. I make pull request for this patch.