summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Systemd.hs
diff options
context:
space:
mode:
authorJoey Hess2015-10-14 13:10:07 -0400
committerJoey Hess2015-10-14 13:10:07 -0400
commit037d287a3a383471edbcd4cf8f490fc4027b67b7 (patch)
treef82c33311ae7a1731a329d40f7643ebed0d60c7b /src/Propellor/Property/Systemd.hs
parentbbb0386515365b6735a9e635baa38fe762c951ef (diff)
fileProperty, and properties derived from it now write the new file content via origfile.propellor-new~, instead of to a randomly named temp file.
This allows them to clean up any temp file that may have been left by an interrupted run of propellor. Also converted the new isSymlinkedTo property to use the same implementation, with some simplifications.
Diffstat (limited to 'src/Propellor/Property/Systemd.hs')
-rw-r--r--src/Propellor/Property/Systemd.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Propellor/Property/Systemd.hs b/src/Propellor/Property/Systemd.hs
index 8194fc85..a93c48bc 100644
--- a/src/Propellor/Property/Systemd.hs
+++ b/src/Propellor/Property/Systemd.hs
@@ -254,8 +254,9 @@ nspawnService (Container name _ _) cfg = setup <!> teardown
<$> servicefilecontent
<*> catchDefaultIO "" (readFile servicefile)
- writeservicefile = property servicefile $ makeChange $
- viaTmp writeFile servicefile =<< servicefilecontent
+ writeservicefile = property servicefile $ makeChange $ do
+ c <- servicefilecontent
+ File.viaStableTmp (\t -> writeFile t c) servicefile
setupservicefile = check (not <$> goodservicefile) $
-- if it's running, it has the wrong configuration,