From 9a0169f0cbdf2470e149a32f5fab8ec2369686f3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Sep 2015 20:11:25 -0400 Subject: clean up privdata excess/lacking newline issue * PrivData converted to newtype (API change). * Stopped stripping trailing newlines when setting PrivData; this was previously done to avoid mistakes when pasting eg passwords with an unwanted newline. Instead, PrivData consumers should use either privDataLines or privDataVal, to extract respectively lines or a value (without internal newlines) from PrivData. --- src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs') diff --git a/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs b/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs index 6a6d5bfd..bd8b1ff3 100644 --- a/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs +++ b/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs @@ -39,10 +39,11 @@ autobuilder arch crontimes timeout = combineProperties "gitannexbuilder" $ props -- password used to upload the built image. rsyncpassword = withPrivData (Password builduser) context $ \getpw -> property "rsync password" $ getpw $ \pw -> do - oldpw <- liftIO $ catchDefaultIO "" $ + have <- liftIO $ catchDefaultIO "" $ readFileStrict pwfile - if pw /= oldpw - then makeChange $ writeFile pwfile pw + let want = privDataVal pw + if want /= have + then makeChange $ writeFile pwfile want else noChange tree :: Architecture -> Property HasInfo -- cgit v1.2.3