deal with NoUUID in checkCanProxy

updatecluster, updateproxy: When a remote that has no annex-uuid is
configured as annex-cluster-node, warn and avoid writing bad data to the
git-annex branch.

The proxy.log and cluster.log end up unparseable when a NoUUID gets written
to them.
This commit is contained in:
Joey Hess 2025-03-21 12:29:44 -04:00
parent ec43b25fb7
commit d0b5a09b0e
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 29 additions and 13 deletions

View file

@ -1,3 +1,11 @@
git-annex (10.20250321) UNRELEASED; urgency=medium
* updatecluster, updateproxy: When a remote that has no annex-uuid is
configured as annex-cluster-node, warn and avoid writing bad data to
the git-annex branch.
-- Joey Hess <id@joeyh.name> Fri, 21 Mar 2025 12:27:11 -0400
git-annex (10.20250320) upstream; urgency=medium git-annex (10.20250320) upstream; urgency=medium
* Added the compute special remote. * Added the compute special remote.

View file

@ -38,7 +38,7 @@ start = startingCustomOutput (ActionItemOther Nothing) $ do
Nothing -> return Nothing Nothing -> return Nothing
Just [] -> return Nothing Just [] -> return Nothing
Just clusternames -> Just clusternames ->
ifM (Command.UpdateProxy.checkCanProxy r "Cannot use this special remote as a cluster node.") ifM (Command.UpdateProxy.checkCanProxy r "Cannot use this remote as a cluster node.")
( return $ Just $ M.fromList $ ( return $ Just $ M.fromList $
zip clusternames (repeat (S.singleton r)) zip clusternames (repeat (S.singleton r))
, return Nothing , return Nothing

View file

@ -59,24 +59,32 @@ start = startingCustomOutput (ActionItemOther Nothing) $ do
isproxy r isproxy r
| remoteAnnexProxy (R.gitconfig r) || not (null (remoteAnnexClusterNode (R.gitconfig r))) = | remoteAnnexProxy (R.gitconfig r) || not (null (remoteAnnexClusterNode (R.gitconfig r))) =
checkCanProxy r "Cannot proxy to this special remote." checkCanProxy r "Cannot proxy to this remote."
| otherwise = pure False | otherwise = pure False
checkCanProxy :: Remote -> String -> Annex Bool checkCanProxy :: Remote -> String -> Annex Bool
checkCanProxy r cannotmessage = checkCanProxy r cannotmessage
ifM (R.isExportSupported r) | R.uuid r == NoUUID = do
( if annexObjects (R.config r) warning $ UnquotedString $ unwords
then pure True [ R.name r
else do , "is a git remote without a known annex-uuid."
warnannexobjects , cannotmessage
pure False ]
, pure True pure False
) | otherwise =
ifM (R.isExportSupported r)
( if annexObjects (R.config r)
then pure True
else do
warnannexobjects
pure False
, pure True
)
where where
warnannexobjects = warning $ UnquotedString $ unwords warnannexobjects = warning $ UnquotedString $ unwords
[ R.name r [ R.name r
, "is configured with exporttree=yes, but without" , "is a special remote configured with exporttree=yes,"
, "annexobjects=yes." , "but without annexobjects=yes."
, cannotmessage , cannotmessage
, "Suggest you run: git-annex enableremote" , "Suggest you run: git-annex enableremote"
, R.name r , R.name r