-
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
/usr/bin/salt-call network.interfaces not working in v.17 like it did in v.16.4 in a cronjob #7990
Comments
On a related note, fetching the ip_interfaces grain also does not appear to work from within a cronjob:
cronjob:
recorded output from cronjob:
output when not called from cronjob:
This is specific to this grain and function. I'm able to fetch any other system grain (or grain I create) without issue. Is this due to the dynamic nature of interface handling? |
One more finding... I'm able to get my scripts to run properly when using salt's internal scheduler (both "grains.get ip_interfaces" and "network.interfaces" return the appropriate network configuration output ). I'm guessing that this is the preferred approach to running these types of scripts over using cron? Is support for cron (external schedulers) being deprecated? |
Are you using 0.17.1 or 0.17.0? This may be related to a change we made for 0.17.1. |
This stopped working in v.17.0. I just upgraded to v.17.1 (I have another thread started with the problems I've encountered there). Most of my minions are still running v.17.0 but the master and 3 of minions are now on v.17.1. The behavior is exactly the same with regards to this problem with both versions at least as far as I can tell. |
Thanks for the update. We'll get this fixed. |
I just tested this on a debian wheezy minion and was not able to reproduce the problem. I tested both with 0.17.1 and the latest from git. What OS and version is your minion running? |
@terminalmage: This is definitely not working on both my 17.0 and 17.1 minions. My minions are all either RHEL5 or RHEL6. Versions reports:
OSs:
I have this working with salt's internal scheduler now instead. |
@shantanub What shell does the root user use on your master? I'm still unable to reproduce this and want to try to more closely match your setup |
@terminalmage bash. We have a pretty plain vanilla RHEL5/6 setup outside of bonding/vlan tagging. You can't replicate this with rhel5 or 6? I just upgraded to salt v.17.2 and have the same issue with network.interfaces lookups (and grains.get ip_interfaces) via cron. This works perfectly fine with salt's built in scheduler. Why do you think the shell might be a factor? What's fundamentally different when I use salt's scheduler vs. cron when I make the same dump of networking info? And maybe just as importantly, what's changed? This can't just be an artifact of cron if I had working code that no longer works with minion version upgrades. I've been able to move on since I've moved the reporting info into a state that's called hourly through highstate (via pillar and salt's internal scheduler), though this is pretty weird. |
I was just looking for other possible differences between your setup and mine. I'll continue to try to replicate this, thanks. |
OK, I was able to reproduce this on CentOS 5. The issue lies in the helper function Working on this and will test and let you know what I find. |
@shantanub I submitted a fix for this in #9148, but this may not actually be merged, because there's an argument to be made for the user keeping track of their own PATH. Can you try specifying a PATH in your crontab?
|
@terminalmage Looks like the path was it. Thanks. I've always specified everything in our cronjobs with absolute paths so I didn't notice this with my other jobs. |
Removed the extra logic from which(). It confuses salt and users. If it's needed to run salt from crontab there are two cases. The first one proposed by @terminalmage above. It specifies PATH for all cron tasks. The second one specifies PATH for the only needed task (salt):
|
This is a really weird problem and something I've usually only seen with cronjobs when an interactive shell is required but unavailable due to the nature of cron.
I have the following call that I execute as a part of a script that sits in a cronjob run by root:
This call produces valid output when called interactively in a normal shell as root but produces nothing when the same call is made from within a cronjob.
I haven't made any substantive changes to this shell script or call but this script broke upon upgrading to v.17. Is this a bug? Or is there some other way I can poll and pull networking information out? I need mac-addresses, interface names (virtual and physical) and IPs.
Thanks.
The text was updated successfully, but these errors were encountered: