Stop race condition of reading a file before written to. Refs #1935.
Stop race condition of reading a file before written to. Refs #1935.

This issue started to appear at some random times. After some hours narrowing down the problem I came to the conclusion that, on some systems, specially under heavy load the file was being read before it was fully written to. This behaviour was visible on a local vagrant machine, and also on travis-ci which also uses vagrant, so, it might actually be an issue with the vagrant(VirtualBox) filesystem access. Anyway, using the atomic open we seem to completely avoid this issue. Not closing ticket just yet so we can keep checking if this is really gone.

saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt