summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Apt.hs
diff options
context:
space:
mode:
authorSean Whitton2017-03-19 11:43:55 -0700
committerSean Whitton2017-03-19 11:45:23 -0700
commit9d54717be5c894957bfc770315d45a13cc19cfe2 (patch)
tree4d60b936b85def934f5730c3239ceefc3f41cc6e /src/Propellor/Property/Apt.hs
parentdeda66755b5f4075909db3a5dcf45abb2c941f29 (diff)
shorten names of mirror properties
Diffstat (limited to 'src/Propellor/Property/Apt.hs')
-rw-r--r--src/Propellor/Property/Apt.hs30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs
index 009b426b..8f4678df 100644
--- a/src/Propellor/Property/Apt.hs
+++ b/src/Propellor/Property/Apt.hs
@@ -21,13 +21,13 @@ data HostMirror = HostMirror Url
deriving (Eq, Show, Typeable)
-- | Indicate host's preferred apt mirror (e.g. an apt cacher on the host's LAN)
-hostMirrorIs :: Url -> Property (HasInfo + UnixLike)
-hostMirrorIs u = pureInfoProperty (u ++ " apt mirror selected")
+mirror :: Url -> Property (HasInfo + UnixLike)
+mirror u = pureInfoProperty (u ++ " apt mirror selected")
(InfoVal (HostMirror u))
-getHostMirror :: Propellor Url
-getHostMirror = do
- mirrorInfo <- getHostMirrorInfo
+getMirror :: Propellor Url
+getMirror = do
+ mirrorInfo <- getMirrorInfo
osInfo <- getOS
return $ case (osInfo, mirrorInfo) of
(_, Just (HostMirror u)) -> u
@@ -39,12 +39,12 @@ getHostMirror = do
error ("no Apt mirror defined for " ++ show dist)
_ -> error "no Apt mirror defined for this host or OS"
where
- getHostMirrorInfo :: Propellor (Maybe HostMirror)
- getHostMirrorInfo = fromInfoVal <$> askInfo
+ getMirrorInfo :: Propellor (Maybe HostMirror)
+ getMirrorInfo = fromInfoVal <$> askInfo
-withHostMirror :: Desc -> (Url -> Property DebianLike) -> Property DebianLike
-withHostMirror desc mkp = property' desc $ \w -> do
- u <- getHostMirror
+withMirror :: Desc -> (Url -> Property DebianLike) -> Property DebianLike
+withMirror desc mkp = property' desc $ \w -> do
+ u <- getMirror
ensureProperty w (mkp u)
sourcesList :: FilePath
@@ -70,8 +70,8 @@ stableUpdatesSuite (Stable s) = Just (s ++ "-updates")
stableUpdatesSuite _ = Nothing
debLine :: String -> Url -> [Section] -> Line
-debLine suite mirror sections = unwords $
- ["deb", mirror, suite] ++ sections
+debLine suite url sections = unwords $
+ ["deb", url, suite] ++ sections
srcLine :: Line -> Line
srcLine l = case words l of
@@ -95,7 +95,7 @@ binandsrc url suite = catMaybes
return $ debLine bs url stdSections
stdArchiveLines :: Propellor SourcesGenerator
-stdArchiveLines = return . binandsrc =<< getHostMirror
+stdArchiveLines = return . binandsrc =<< getMirror
-- | Only available for Stable and Testing
securityUpdates :: SourcesGenerator
@@ -122,7 +122,7 @@ stdSourcesListFor suite = stdSourcesList' suite []
-- to do so via a separate file in </etc/apt/sources.list.d/>
stdSourcesList' :: DebianSuite -> [SourcesGenerator] -> Property Debian
stdSourcesList' suite more = tightenTargets $
- withHostMirror desc $ \u -> setSourcesList
+ withMirror desc $ \u -> setSourcesList
(concatMap (\gen -> gen suite) (generators u))
where
generators u = [binandsrc u, securityUpdates] ++ more
@@ -154,7 +154,7 @@ suiteAvailablePinned s pin = available <!> unavailable
& File.notPresent prefFile
setSourcesFile :: Property Debian
- setSourcesFile = tightenTargets $ withHostMirror (desc True) $ \u ->
+ setSourcesFile = tightenTargets $ withMirror (desc True) $ \u ->
withOS (desc True) $ \w o -> case o of
(Just (System (Debian _ hostSuite) _))
| s /= hostSuite -> ensureProperty w $