saltstack/salt — Issue #827: sysctl state removes existing entries, race condition
Author: gerard-lynch
Created: 2012-03-04 15:42:37+00:00
State: open

Does this open issue (https://github.com/saltstack/salt/issues/156) still apply?

Working off http://salt.readthedocs.org/en/latest/ref/states/all/salt.states.sysctl.html

Salt Master/Minion ver. 0.9.6-2
CentOS 6.2

ISSUE:
When applying a sysctl state, the existing (default) entries in the sysctl.conf file are lost. There also appears to be a race-condition as out of 5-10 entries I'm trying to write, only one is being written.

e.g. state structure
-----------------------
top.sls
base:
'*':
- kernel

kernel.sls
net.ipv4.tcp_max_syn_backlog:
sysctl:
- present
- value: 4096

net.ipv4.tcp_keepalive_time:
sysctl:
- present
- value: 1800
-----------------------

If I'm reading the code correctly, there's nothing in the logic that will write existing entries back. I believe there needs to be an "else" statement after the "if name == comps[0]:", i.e. else if the name doesn't match append it anyway.
salt/modules/linux_sysctl.py (line 89-114)

No idea where the race condition is happening.