From f6b2ab29f24c7399ed7ab718c541eb46bc0f24f7 Mon Sep 17 00:00:00 2001 From: FĂ©lix Sipma Date: Thu, 27 Apr 2017 19:17:34 +0200 Subject: Restic: make sure the repo exists before running restic commands --- src/Propellor/Property/Restic.hs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/Propellor/Property') diff --git a/src/Propellor/Property/Restic.hs b/src/Propellor/Property/Restic.hs index 55a68324..668843bb 100644 --- a/src/Propellor/Property/Restic.hs +++ b/src/Propellor/Property/Restic.hs @@ -86,8 +86,7 @@ init repo = check (not <$> repoExists repo) (cmdProperty "restic" initargs) -- and then moving it to the directory. restored :: FilePath -> ResticRepo -> Property (HasInfo + DebianLike) restored dir repo = go - `requires` installed - `requires` passwordFileConfigured repo + `requires` init repo where go :: Property DebianLike go = property (dir ++ " restored by restic") $ ifM (liftIO needsRestore) @@ -146,8 +145,7 @@ backup dir repo crontimes extraargs kp = backup' dir repo crontimes extraargs kp backup' :: FilePath -> ResticRepo -> Cron.Times -> [ResticParam] -> [KeepPolicy] -> Property (HasInfo + DebianLike) backup' dir repo crontimes extraargs kp = cronjob `describe` desc - `requires` installed - `requires` passwordFileConfigured repo + `requires` init repo where desc = val repo ++ " restic backup" cronjob = Cron.niceJob ("restic_backup" ++ dir) crontimes (User "root") "/" $ -- cgit v1.2.3