From b9d9333e030ac59ea11d435b7e2e4758daff4b4a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 18 Jan 2019 02:19:06 -0400 Subject: fix withOS type level bug withOS had a type level bug that allowed ensureProperty to be used inside it with a Property that does not match the type of the withOS itself. Propellor.Property.Cron.runPropellor is a Property DebianLike; it was incorrectly a Property UnixLike before and that wrong type was hidden by the withOS bug. This commit was sponsored by Jack Hill on Patreon. --- src/Propellor/Property/Borg.hs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/Propellor/Property/Borg.hs') diff --git a/src/Propellor/Property/Borg.hs b/src/Propellor/Property/Borg.hs index 9d49fdf4..f662c8ee 100644 --- a/src/Propellor/Property/Borg.hs +++ b/src/Propellor/Property/Borg.hs @@ -59,12 +59,15 @@ runBorgEnv (BorgRepoUsing os _) = map go os go (UsesEnvVar (k, v)) = (k, v) installed :: Property DebianLike -installed = withOS desc $ \w o -> case o of - (Just (System (Debian _ (Stable "jessie")) _)) -> ensureProperty w $ - Apt.backportInstalled ["borgbackup", "python3-msgpack"] - _ -> ensureProperty w $ - Apt.installed ["borgbackup"] +installed = pickOS installdebian aptinstall where + installdebian :: Property Debian + installdebian = withOS desc $ \w o -> case o of + (Just (System (Debian _ (Stable "jessie")) _)) -> ensureProperty w $ + Apt.backportInstalled ["borgbackup", "python3-msgpack"] + _ -> ensureProperty w $ + Apt.installed ["borgbackup"] + aptinstall = Apt.installed ["borgbackup"] `describe` desc desc = "installed borgbackup" repoExists :: BorgRepo -> IO Bool -- cgit v1.2.3