fix cycle prevention code
This commit is contained in:
parent
07e899c9d3
commit
923953c9fe
1 changed files with 8 additions and 7 deletions
|
@ -32,7 +32,7 @@ start = startingCustomOutput (ActionItemOther Nothing) $ do
|
||||||
rs <- R.remoteList
|
rs <- R.remoteList
|
||||||
let remoteproxies = S.fromList $ map mkproxy $
|
let remoteproxies = S.fromList $ map mkproxy $
|
||||||
filter (isproxy . R.gitconfig) rs
|
filter (isproxy . R.gitconfig) rs
|
||||||
clusterproxies <- getClusterProxies
|
clusterproxies <- getClusterProxies remoteproxies
|
||||||
let proxies = S.union remoteproxies clusterproxies
|
let proxies = S.union remoteproxies clusterproxies
|
||||||
u <- getUUID
|
u <- getUUID
|
||||||
oldproxies <- fromMaybe mempty . M.lookup u <$> getProxies
|
oldproxies <- fromMaybe mempty . M.lookup u <$> getProxies
|
||||||
|
@ -61,18 +61,19 @@ start = startingCustomOutput (ActionItemOther Nothing) $ do
|
||||||
-- Automatically proxy nodes of any cluster this repository is configured
|
-- Automatically proxy nodes of any cluster this repository is configured
|
||||||
-- to serve as a gateway for. Also proxy other cluster nodes that are
|
-- to serve as a gateway for. Also proxy other cluster nodes that are
|
||||||
-- themselves proxied via other remotes.
|
-- themselves proxied via other remotes.
|
||||||
getClusterProxies :: Annex (S.Set Proxy)
|
getClusterProxies :: S.Set Proxy -> Annex (S.Set Proxy)
|
||||||
getClusterProxies = do
|
getClusterProxies remoteproxies = do
|
||||||
mynodes <- (map mkclusterproxy . M.toList . annexClusters)
|
myclusters <- (map mkclusterproxy . M.toList . annexClusters)
|
||||||
<$> Annex.getGitConfig
|
<$> Annex.getGitConfig
|
||||||
remoteproxiednodes <- findRemoteProxiedClusterNodes
|
remoteproxiednodes <- findRemoteProxiedClusterNodes
|
||||||
let mynodesuuids = S.fromList $ map proxyRemoteUUID mynodes
|
let myproxieduuids = S.map proxyRemoteUUID remoteproxies
|
||||||
|
<> S.fromList (map proxyRemoteUUID myclusters)
|
||||||
-- filter out nodes we proxy for from the remote proxied nodes
|
-- filter out nodes we proxy for from the remote proxied nodes
|
||||||
-- to avoid cycles
|
-- to avoid cycles
|
||||||
let remoteproxiednodes' = filter
|
let remoteproxiednodes' = filter
|
||||||
(\n -> proxyRemoteUUID n `S.notMember` mynodesuuids)
|
(\n -> proxyRemoteUUID n `S.notMember` myproxieduuids)
|
||||||
remoteproxiednodes
|
remoteproxiednodes
|
||||||
return (S.fromList (mynodes ++ remoteproxiednodes'))
|
return (S.fromList (myclusters ++ remoteproxiednodes'))
|
||||||
where
|
where
|
||||||
mkclusterproxy (remotename, cu) =
|
mkclusterproxy (remotename, cu) =
|
||||||
Proxy (fromClusterUUID cu) remotename
|
Proxy (fromClusterUUID cu) remotename
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue