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.
This commit is contained in:
Joey Hess 2014-10-23 12:11:07 -04:00
parent 5c480fc9e7
commit 73a75cbefc
3 changed files with 6 additions and 2 deletions

1
debian/changelog vendored
View File

@ -3,6 +3,7 @@ propellor (0.9.1) UNRELEASED; urgency=medium
* Docker: Add ability to control when containers restart.
* Docker: Default to always restarting containers, so they come back
up after reboots and docker daemon upgrades.
* Fix loop when a docker host that does not exist was docked.
-- Joey Hess <joeyh@debian.org> Thu, 23 Oct 2014 03:05:22 -0400

View File

@ -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)

View File

@ -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