From a4ce5d7aff72e874eda19a7ff9f1f59e91931457 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 7 Feb 2016 13:01:43 -0400 Subject: force-lock fails when repo doesn't exist, so don't && it --- src/Propellor/Property/Obnam.hs | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'src/Propellor') diff --git a/src/Propellor/Property/Obnam.hs b/src/Propellor/Property/Obnam.hs index 684c424e..9a391967 100644 --- a/src/Propellor/Property/Obnam.hs +++ b/src/Propellor/Property/Obnam.hs @@ -59,25 +59,29 @@ backup' dir crontimes params numclients = cronjob `describe` desc where desc = dir ++ " backed up by obnam" cronjob = Cron.niceJob ("obnam_backup" ++ dir) crontimes (User "root") "/" $ - intercalate "&&" $ catMaybes + unwords $ catMaybes [ if numclients == OnlyClient - then Just $ unwords $ - [ "obnam" - , "force-lock" - ] ++ map shellEscape params + -- forcelock fails if repo does not exist yet + then Just $ forcelock ++ " 2>/dev/null ;" else Nothing - , Just $ unwords $ - [ "obnam" - , "backup" - , shellEscape dir - ] ++ map shellEscape params + , Just backup , if any isKeepParam params - then Just $ unwords $ - [ "obnam" - , "forget" - ] ++ map shellEscape params + then Just $ "&& " ++ forget else Nothing ] + forcelock = unwords $ + [ "obnam" + , "force-lock" + ] ++ map shellEscape params + backup = unwords $ + [ "obnam" + , "backup" + , shellEscape dir + ] ++ map shellEscape params + forget = unwords $ + [ "obnam" + , "forget" + ] ++ map shellEscape params -- | Restores a directory from an obnam backup. -- -- cgit v1.2.3