summaryrefslogtreecommitdiff
path: root/Propellor
diff options
context:
space:
mode:
authorJoey Hess2014-04-13 17:50:44 -0400
committerJoey Hess2014-04-13 17:50:44 -0400
commit90370dc57576ec6d4701acd4b5672eeba269a386 (patch)
tree798ade3f259fdd1eaa1b1a89030cc304028d4254 /Propellor
parent38cd54a7ee853f13036a02205e1655eac6e7b43a (diff)
stable-backports can't be used :(
Diffstat (limited to 'Propellor')
-rw-r--r--Propellor/Property/Apache.hs4
-rw-r--r--Propellor/Property/Apt.hs15
-rw-r--r--Propellor/Types/OS.hs7
3 files changed, 19 insertions, 7 deletions
diff --git a/Propellor/Property/Apache.hs b/Propellor/Property/Apache.hs
index 81daf9e7..eab87862 100644
--- a/Propellor/Property/Apache.hs
+++ b/Propellor/Property/Apache.hs
@@ -11,10 +11,12 @@ siteEnabled :: HostName -> ConfigFile -> RevertableProperty
siteEnabled hn cf = RevertableProperty enable disable
where
enable = cmdProperty "a2ensite" ["--quiet", hn]
+ `describe` ("apache site enabled " ++ hn)
`requires` siteAvailable hn cf
`requires` installed
`onChange` reloaded
disable = File.notPresent (siteCfg hn)
+ `describe` ("apache site disabled " ++ hn)
`onChange` cmdProperty "a2dissite" ["--quiet", hn]
`requires` installed
`onChange` reloaded
@@ -29,9 +31,11 @@ modEnabled :: String -> RevertableProperty
modEnabled modname = RevertableProperty enable disable
where
enable = cmdProperty "a2enmod" ["--quiet", modname]
+ `describe` ("apache module enabled " ++ modname)
`requires` installed
`onChange` reloaded
disable = cmdProperty "a2dismod" ["--quiet", modname]
+ `describe` ("apache module disabled " ++ modname)
`requires` installed
`onChange` reloaded
diff --git a/Propellor/Property/Apt.hs b/Propellor/Property/Apt.hs
index b7c281ce..5c095d64 100644
--- a/Propellor/Property/Apt.hs
+++ b/Propellor/Property/Apt.hs
@@ -24,8 +24,8 @@ showSuite Unstable = "unstable"
showSuite Experimental = "experimental"
showSuite (DebianRelease r) = r
-backportSuite :: DebianSuite -> String
-backportSuite suite = showSuite suite ++ "-backports"
+backportSuite :: String
+backportSuite = showSuite stableRelease ++ "-backports"
debLine :: String -> Url -> [Section] -> Line
debLine suite mirror sections = unwords $
@@ -41,11 +41,11 @@ stdSections = ["main", "contrib", "non-free"]
binandsrc :: String -> DebianSuite -> [Line]
binandsrc url suite
- | suite == Stable = [l, srcLine l, bl, srcLine bl]
+ | isStable suite = [l, srcLine l, bl, srcLine bl]
| otherwise = [l, srcLine l]
where
l = debLine (showSuite suite) url stdSections
- bl = debLine (backportSuite suite) url stdSections
+ bl = debLine backportSuite url stdSections
debCdn :: DebianSuite -> [Line]
debCdn = binandsrc "http://cdn.debian.net/debian"
@@ -56,7 +56,7 @@ kernelOrg = binandsrc "http://mirrors.kernel.org/debian"
-- | Only available for Stable and Testing
securityUpdates :: DebianSuite -> [Line]
securityUpdates suite
- | suite == Stable || suite == Testing =
+ | isStable suite || suite == Testing =
let l = "deb http://security.debian.org/ " ++ showSuite suite ++ "/updates " ++ unwords stdSections
in [l, srcLine l]
| otherwise = []
@@ -104,9 +104,10 @@ installed' params ps = robustly $ check (isInstallable ps) go
installedBackport :: [Package] -> Property
installedBackport ps = withOS desc $ \o -> case o of
- (Just (System (Debian suite) _)) ->
- ensureProperty $ installed' ["-t", backportSuite suite, "-y"] ps
Nothing -> error "cannot install backports; os not declared"
+ (Just (System (Debian suite) _))
+ | isStable suite ->
+ ensureProperty $ installed' ["-t", backportSuite, "-y"] ps
_ -> error $ "backports not supported on " ++ show o
where
desc = (unwords $ "apt installed backport":ps)
diff --git a/Propellor/Types/OS.hs b/Propellor/Types/OS.hs
index 5b0e376d..0635b271 100644
--- a/Propellor/Types/OS.hs
+++ b/Propellor/Types/OS.hs
@@ -15,5 +15,12 @@ data Distribution
data DebianSuite = Experimental | Unstable | Testing | Stable | DebianRelease Release
deriving (Show, Eq)
+-- | The release that currently corresponds to stable.
+stableRelease :: DebianSuite
+stableRelease = DebianRelease "wheezy"
+
+isStable :: DebianSuite -> Bool
+isStable s = s == Stable || s == stableRelease
+
type Release = String
type Architecture = String