summaryrefslogtreecommitdiff
path: root/src/Propellor
diff options
context:
space:
mode:
authorJoey Hess2014-10-23 12:11:07 -0400
committerJoey Hess2014-10-23 12:11:43 -0400
commit73a75cbefc242133b921fe7314e596ea12bdfbea (patch)
tree17c184354d7bd4d2f5ce3d862ebdff2e13d124c6 /src/Propellor
parent5c480fc9e7279d76e5fe4dbab8b339a71de3bc67 (diff)
Fix loop when a docker host that does not exist was docked.
The problem is it fell back to looking for an alias for the bad hostname, but to get the aliases, it needs to know which hosts are docked where, so looped.
Diffstat (limited to 'src/Propellor')
-rw-r--r--src/Propellor/Info.hs5
-rw-r--r--src/Propellor/Property/Docker.hs2
2 files changed, 5 insertions, 2 deletions
diff --git a/src/Propellor/Info.hs b/src/Propellor/Info.hs
index 1b89c008..f44d1de3 100644
--- a/src/Propellor/Info.hs
+++ b/src/Propellor/Info.hs
@@ -80,7 +80,10 @@ aliasMap = M.fromList . concat .
map (\h -> map (\aka -> (aka, h)) $ S.toList $ _aliases $ hostInfo h)
findHost :: [Host] -> HostName -> Maybe Host
-findHost l hn = maybe (findAlias l hn) Just (M.lookup hn (hostMap l))
+findHost l hn = maybe (findAlias l hn) Just (findHostNoAlias l hn)
+
+findHostNoAlias :: [Host] -> HostName -> Maybe Host
+findHostNoAlias l hn = M.lookup hn (hostMap l)
findAlias :: [Host] -> HostName -> Maybe Host
findAlias l hn = M.lookup hn (aliasMap l)
diff --git a/src/Propellor/Property/Docker.hs b/src/Propellor/Property/Docker.hs
index b717fe19..c91530c3 100644
--- a/src/Propellor/Property/Docker.hs
+++ b/src/Propellor/Property/Docker.hs
@@ -107,7 +107,7 @@ docked hosts cn = RevertableProperty
let cid = ContainerId hn cn
ensureProperties [findContainer mhost cid cn $ a cid]
- mhost = findHost hosts (cn2hn cn)
+ mhost = findHostNoAlias hosts (cn2hn cn)
setup cid (Container image runparams) =
provisionContainer cid