saltstack/salt — pull request #18079 by oldmantaiter (2014-11-14 02:49:43+00:00)
Title: Fix for cross-platform sysctl with test and custom config location when using systemd >= 207

When using a custom config path for sysctl states, it would fail with an IOError
as it was looking for the defaults which also may not exist as shown below:

----------
ID: net.ipv4.tcp_keepalive_intvl
Function: sysctl.present
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/salt/state.py", line 1533, in call
**cdata['kwargs'])
File "/usr/lib/python2.7/site-packages/salt/states/sysctl.py", line 56, in present
configured = __salt__['sysctl.show'](config_file=True)
File "/usr/lib/python2.7/site-packages/salt/modules/linux_sysctl.py", line 86, in show
for line in salt.utils.fopen(config_file_path):
File "/usr/lib/python2.7/site-packages/salt/utils/__init__.py", line 1065, in fopen
fhandle = open(*args, **kwargs)
IOError: [Errno 2] No such file or directory: '/etc/sysctl.d/99-salt.conf'

The corresponding state had a config file specified that was ignored. But this would hold true for any
minion meeting the systemd conditions and not having 99-salt.conf. Now, for normal highstate runs, the current
and configured options are not run unless test is specified and if the configured check returns none, the
user will be notified that there was an issue reading the default/specified file.

Platforms other than linux also appeared to not have the config_file argument for show() that would have probably (I did not verify) bail out with argument number errors during normal runs.