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

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