Problem
-------
In the imperative sequence::
if not os.path.isdir(folder_name):
os.makedirs(folder_name)
There exists the possibility that another process may create ``folder_name``
between the system path test and the system folder construction. This is
especially true when launching both the salt-minion and salt-master
simultaneously::
# systemctl status -l salt-minion salt-master
* salt-minion.service - The Salt Minion
Loaded: loaded (/usr/lib/systemd/system/salt-minion.service; enabled)
Active: inactive (dead) since Sat 2015-03-07 21:38:53 UTC; 7h ago
Process: 1168 ExecStart=/usr/bin/salt-minion (code=exited, status=0/SUCCESS)
Main PID: 1168 (code=exited, status=0/SUCCESS)
Mar 07 21:36:29 local.dev systemd[1]: Started The Salt Minion.
Mar 07 21:38:53 local.dev salt-minion[1168]: [ERROR ] Attempt to authenticate with the salt master failed
* salt-master.service - The Salt Master Server
Loaded: loaded (/usr/lib/systemd/system/salt-master.service; enabled)
Active: failed (Result: exit-code) since Sat 2015-03-07 21:37:53 UTC; 7h ago
Process: 1166 ExecStart=/usr/bin/salt-master (code=exited, status=17)
Main PID: 1166 (code=exited, status=17)
Mar 07 21:37:52 local.dev salt-master[1166]: Failed to create path "/var/log/salt/master" - [Errno 17] File exists: '/var/log/salt'
Mar 07 21:37:53 local.dev systemd[1]: salt-master.service: main process exited, code=exited, status=17/n/a
Mar 07 21:37:53 local.dev systemd[1]: Failed to start The Salt Master Server.
Mar 07 21:37:53 local.dev systemd[1]: Unit salt-master.service entered failed state.
In such cases, the salt-minion tested for the non-existence (true), then
salt-master also tested (true). salt-minion created the folder, but
salt-master failed (with Errno 17: File exists).
Solution
--------
Do not test for path existence at all, always create, expecting errno.EEXISTS
as an acceptable condition. This delegates responsibility of handling such
"race conditions" to the kernel where locks exist to prevent it.
blkid() was iterating over an empty list before checking it's length.
Prevent this by using 'cmd.run_all' instead and checking it's returncode
before using the results.
Fixes saltstack#20915
Modifies `service.running` and `service.dead` to update the `ret`
variable based on the return value of `_enable()` or `_disable()`.
Modifies `_enable()` and `_disable()` so they return a dict that only
contains keys changed by the referenced function (rather than a full
state dict).
- present func: should not require key/fingerprint.
In normal mode, key AND fingerprint can be omitted but
test mode requires them, so fix the test mode to behave same
way.
- absent function: return correct ret when change suppose to be made.
- refactor a bit.
Do not translate debian style attributes to salt style attributes in
_parse_interfaces. The `iface_dict` expects the debian style
attribute names anyway.
Fixes#18318 (in 2014.7 and up, the part of missing options, not the
removing coments part)
When comments contain whitespaces they won't be copied over currently.
This is because the split keeps splitting along the whitespaces.
Reproduce:
```
name = "ecdsa-sha2-nistp256 awesomlylongkey= The Loeki proposes a fix for this"
```
* remove duplicate 'mode' from bridge as well
* fixes output for bond slave interfaces
* fixes minor typo
* fixes bonding example
--
Squashed working commits into one PR commit