deal with NoUUID in checkCanProxy
authorJoey Hess <joeyh@joeyh.name>
Fri, 21 Mar 2025 16:29:44 +0000 (12:29 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 21 Mar 2025 16:29:44 +0000 (12:29 -0400)
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.

CHANGELOG
Command/UpdateCluster.hs
Command/UpdateProxy.hs

index 24efe49550885ecd63cdd45aea5d638ab04ddd60..624d23dfd665f5973ace362c958df78fd720c66e 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -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
 
   * Added the compute special remote.
index 003ab48ed6294d6039f5a07c138f3a0dc0d7898f..be271d64fc6a4412f5daecc73d3ec106daf1e774 100644 (file)
@@ -38,7 +38,7 @@ start = startingCustomOutput (ActionItemOther Nothing) $ do
                Nothing -> return Nothing
                Just [] -> return Nothing
                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 $
                                        zip clusternames (repeat (S.singleton r))
                                , return Nothing
index 88a8ecaf77f33ef2970e20e47ceaed39041f4edf..006e618b6015e5ae54942a2fa971730a375e186f 100644 (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