From 714cb4e3425b61b204589ceeb7eb63fcd2b7d4e4 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Fri, 20 May 2016 06:22:11 +0900 Subject: move fixConfFile into the propellor monad --- src/Propellor/Property/Sbuild.hs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/Propellor/Property/Sbuild.hs b/src/Propellor/Property/Sbuild.hs index cb19d525..8b0748e4 100644 --- a/src/Propellor/Property/Sbuild.hs +++ b/src/Propellor/Property/Sbuild.hs @@ -158,11 +158,15 @@ updated s@(SbuildSchroot suite arch) = -- -- The properties in this module only permit the creation of one chroot for a -- given suite and architecture, so we don't need the suffix to be random. -fixConfFile :: SbuildSchroot -> IO () -fixConfFile s@(SbuildSchroot suite arch) = do - old <- concat . filter (tempPrefix `isPrefixOf`) <$> dirContents dir - ensureProperty $ File.fileProperty "replace dummy suffix" (map munge) old - moveFile old new +fixConfFile :: SbuildSchroot -> Property UnixLike +fixConfFile s@(SbuildSchroot suite arch) = + property' ("schroot for " ++ show s ++ " config file fixed") $ \w -> do + confs <- liftIO $ dirContents dir + let old = concat $ filter (tempPrefix `isPrefixOf`) confs + ensureProperty w $ + File.fileProperty "replace dummy suffix" (map munge) old + liftIO $ moveFile old new + return MadeChange where new = schrootConf s dir = takeDirectory new -- cgit v1.2.3