summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Sbuild.hs
diff options
context:
space:
mode:
authorJoey Hess2017-11-20 14:32:40 -0700
committerSean Whitton2017-11-20 14:32:40 -0700
commit57b084713497bf16a59cc0769148bfad7c7cea71 (patch)
tree579cdaa3be43daac1a60527c7f3065f51bee77ad /src/Propellor/Property/Sbuild.hs
parent1aaf9c5b080058617d0204219d1c101a345dc6fb (diff)
prevent Sbuilt.useHostProxy from looping by not peeking too early
Diffstat (limited to 'src/Propellor/Property/Sbuild.hs')
-rw-r--r--src/Propellor/Property/Sbuild.hs13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/Propellor/Property/Sbuild.hs b/src/Propellor/Property/Sbuild.hs
index f884b352..d323ee67 100644
--- a/src/Propellor/Property/Sbuild.hs
+++ b/src/Propellor/Property/Sbuild.hs
@@ -252,12 +252,15 @@ update = Apt.update `before` Apt.upgrade `before` Apt.autoRemove
-- | Ensure that an sbuild schroot uses the host's Apt proxy.
--
-- This property is standardly used when the host has 'Apt.useLocalCacher'.
-useHostProxy :: Host -> Property (HasInfo + DebianLike)
-useHostProxy h = case getProxyInfo of
- Nothing -> doNothing
- Just (Apt.HostAptProxy u) -> Apt.proxy u
+useHostProxy :: Host -> Property DebianLike
+useHostProxy h = property' "use host's apt proxy" $ \w ->
+ -- Note that we can't look at getProxyInfo outside the property,
+ -- as that would loop, but it's ok to look at it inside the
+ -- property. Thus the slightly strange construction here.
+ case getProxyInfo of
+ Just (Apt.HostAptProxy u) -> ensureProperty w (Apt.proxy' u)
+ Nothing -> noChange
where
- getProxyInfo :: Maybe Apt.HostAptProxy
getProxyInfo = fromInfoVal . fromInfo . hostInfo $ h
aptCacheLine :: String