add git configs for clusters
This commit is contained in:
parent
de1d795dfe
commit
2844230dfe
6 changed files with 49 additions and 7 deletions
|
@ -1,6 +1,9 @@
|
||||||
git-annex (10.20240532) UNRELEASED; urgency=medium
|
git-annex (10.20240532) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
* Added updateproxy command and remote.name.annex-proxy configuration.
|
* Added git-annex updateproxy command and remote.name.annex-proxy
|
||||||
|
configuration.
|
||||||
|
* Added git-annex cluster command and remote.name.annex-cluster-node
|
||||||
|
and annex.cluster.name configuration.
|
||||||
* Fix a bug where interrupting git-annex while it is updating the
|
* Fix a bug where interrupting git-annex while it is updating the
|
||||||
git-annex branch for an export could later lead to git fsck
|
git-annex branch for an export could later lead to git fsck
|
||||||
complaining about missing tree objects.
|
complaining about missing tree objects.
|
||||||
|
|
|
@ -34,8 +34,8 @@ newtype ClusterUUID = ClusterUUID UUID
|
||||||
|
|
||||||
-- Smart constructor for a ClusterUUID.
|
-- Smart constructor for a ClusterUUID.
|
||||||
--
|
--
|
||||||
-- The input UUID can be a regular UUID (eg V4). It is converted to a valid
|
-- The input UUID can be any regular UUID (eg V4). It is converted to a valid
|
||||||
-- cluster uuid.
|
-- cluster UUID.
|
||||||
mkClusterUUID :: UUID -> Maybe ClusterUUID
|
mkClusterUUID :: UUID -> Maybe ClusterUUID
|
||||||
mkClusterUUID (UUID b)
|
mkClusterUUID (UUID b)
|
||||||
| B.length b > 14 = Just $ ClusterUUID $ UUID $
|
| B.length b > 14 = Just $ ClusterUUID $ UUID $
|
||||||
|
|
|
@ -45,6 +45,7 @@ import Types.RefSpec
|
||||||
import Types.RepoVersion
|
import Types.RepoVersion
|
||||||
import Types.StallDetection
|
import Types.StallDetection
|
||||||
import Types.View
|
import Types.View
|
||||||
|
import Types.Cluster
|
||||||
import Config.DynamicConfig
|
import Config.DynamicConfig
|
||||||
import Utility.HumanTime
|
import Utility.HumanTime
|
||||||
import Utility.Gpg (GpgCmd, mkGpgCmd)
|
import Utility.Gpg (GpgCmd, mkGpgCmd)
|
||||||
|
@ -155,6 +156,7 @@ data GitConfig = GitConfig
|
||||||
, annexPrivateRepos :: S.Set UUID
|
, annexPrivateRepos :: S.Set UUID
|
||||||
, annexAdviceNoSshCaching :: Bool
|
, annexAdviceNoSshCaching :: Bool
|
||||||
, annexViewUnsetDirectory :: ViewUnset
|
, annexViewUnsetDirectory :: ViewUnset
|
||||||
|
, annexClusters :: M.Map String ClusterUUID
|
||||||
}
|
}
|
||||||
|
|
||||||
extractGitConfig :: ConfigSource -> Git.Repo -> GitConfig
|
extractGitConfig :: ConfigSource -> Git.Repo -> GitConfig
|
||||||
|
@ -283,6 +285,12 @@ extractGitConfig configsource r = GitConfig
|
||||||
, annexAdviceNoSshCaching = getbool (annexConfig "advicenosshcaching") True
|
, annexAdviceNoSshCaching = getbool (annexConfig "advicenosshcaching") True
|
||||||
, annexViewUnsetDirectory = ViewUnset $ fromMaybe "_" $
|
, annexViewUnsetDirectory = ViewUnset $ fromMaybe "_" $
|
||||||
getmaybe (annexConfig "viewunsetdirectory")
|
getmaybe (annexConfig "viewunsetdirectory")
|
||||||
|
, annexClusters =
|
||||||
|
M.mapMaybe (mkClusterUUID . toUUID) $
|
||||||
|
M.mapKeys (drop (B.length clusterprefix) . fromConfigKey) $
|
||||||
|
M.filterWithKey
|
||||||
|
(\(ConfigKey k) _ -> clusterprefix `B.isPrefixOf` k)
|
||||||
|
(config r)
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
getbool k d = fromMaybe d $ getmaybebool k
|
getbool k d = fromMaybe d $ getmaybebool k
|
||||||
|
@ -307,6 +315,8 @@ extractGitConfig configsource r = GitConfig
|
||||||
|
|
||||||
hereuuid = maybe NoUUID toUUID $ getmaybe (annexConfig "uuid")
|
hereuuid = maybe NoUUID toUUID $ getmaybe (annexConfig "uuid")
|
||||||
|
|
||||||
|
clusterprefix = annexConfigPrefix <> "cluster."
|
||||||
|
|
||||||
{- Merge a GitConfig that comes from git-config with one containing
|
{- Merge a GitConfig that comes from git-config with one containing
|
||||||
- repository-global defaults. -}
|
- repository-global defaults. -}
|
||||||
mergeGitConfig :: GitConfig -> GitConfig -> GitConfig
|
mergeGitConfig :: GitConfig -> GitConfig -> GitConfig
|
||||||
|
@ -377,6 +387,7 @@ data RemoteGitConfig = RemoteGitConfig
|
||||||
, remoteAnnexMaxGitBundles :: Int
|
, remoteAnnexMaxGitBundles :: Int
|
||||||
, remoteAnnexAllowEncryptedGitRepo :: Bool
|
, remoteAnnexAllowEncryptedGitRepo :: Bool
|
||||||
, remoteAnnexProxy :: Bool
|
, remoteAnnexProxy :: Bool
|
||||||
|
, remoteAnnexClusterNode :: Maybe [String]
|
||||||
, remoteUrl :: Maybe String
|
, remoteUrl :: Maybe String
|
||||||
|
|
||||||
{- These settings are specific to particular types of remotes
|
{- These settings are specific to particular types of remotes
|
||||||
|
@ -462,6 +473,7 @@ extractRemoteGitConfig r remotename = do
|
||||||
, remoteAnnexAllowEncryptedGitRepo =
|
, remoteAnnexAllowEncryptedGitRepo =
|
||||||
getbool AllowEncryptedGitRepoField False
|
getbool AllowEncryptedGitRepoField False
|
||||||
, remoteAnnexProxy = getbool ProxyField False
|
, remoteAnnexProxy = getbool ProxyField False
|
||||||
|
, remoteAnnexClusterNode = words <$> getmaybe ClusterNodeField
|
||||||
, remoteUrl =
|
, remoteUrl =
|
||||||
case Git.Config.getMaybe (remoteConfig remotename (remoteGitConfigKey UrlField)) r of
|
case Git.Config.getMaybe (remoteConfig remotename (remoteGitConfigKey UrlField)) r of
|
||||||
Just (ConfigValue b)
|
Just (ConfigValue b)
|
||||||
|
@ -539,6 +551,7 @@ data RemoteGitConfigField
|
||||||
| MaxGitBundlesField
|
| MaxGitBundlesField
|
||||||
| AllowEncryptedGitRepoField
|
| AllowEncryptedGitRepoField
|
||||||
| ProxyField
|
| ProxyField
|
||||||
|
| ClusterNodeField
|
||||||
| UrlField
|
| UrlField
|
||||||
| ShellField
|
| ShellField
|
||||||
| SshOptionsField
|
| SshOptionsField
|
||||||
|
@ -603,6 +616,7 @@ remoteGitConfigField = \case
|
||||||
AllowEncryptedGitRepoField -> inherited "allow-encrypted-gitrepo"
|
AllowEncryptedGitRepoField -> inherited "allow-encrypted-gitrepo"
|
||||||
-- Allow proxy chains.
|
-- Allow proxy chains.
|
||||||
ProxyField -> inherited "proxy"
|
ProxyField -> inherited "proxy"
|
||||||
|
ClusterNodeField -> uninherited "cluster-node"
|
||||||
UrlField -> inherited "url"
|
UrlField -> inherited "url"
|
||||||
ShellField -> inherited "shell"
|
ShellField -> inherited "shell"
|
||||||
SshOptionsField -> inherited "ssh-options"
|
SshOptionsField -> inherited "ssh-options"
|
||||||
|
@ -654,9 +668,12 @@ dummyRemoteGitConfig = atomically $
|
||||||
|
|
||||||
type UnqualifiedConfigKey = B.ByteString
|
type UnqualifiedConfigKey = B.ByteString
|
||||||
|
|
||||||
|
annexConfigPrefix :: B.ByteString
|
||||||
|
annexConfigPrefix = "annex."
|
||||||
|
|
||||||
{- A global annex setting in git config. -}
|
{- A global annex setting in git config. -}
|
||||||
annexConfig :: UnqualifiedConfigKey -> ConfigKey
|
annexConfig :: UnqualifiedConfigKey -> ConfigKey
|
||||||
annexConfig key = ConfigKey ("annex." <> key)
|
annexConfig key = ConfigKey (annexConfigPrefix <> key)
|
||||||
|
|
||||||
class RemoteNameable r where
|
class RemoteNameable r where
|
||||||
getRemoteName :: r -> RemoteName
|
getRemoteName :: r -> RemoteName
|
||||||
|
|
|
@ -8,7 +8,7 @@ Each repository has a preferred content setting, which specifies content
|
||||||
that the repository wants to have present. These settings can be configured
|
that the repository wants to have present. These settings can be configured
|
||||||
using `git annex vicfg` or `git annex wanted`.
|
using `git annex vicfg` or `git annex wanted`.
|
||||||
They are used by the `--auto` option, by `git annex sync --content`,
|
They are used by the `--auto` option, by `git annex sync --content`,
|
||||||
and by the git-annex assistant.
|
by clusters, and by the git-annex assistant.
|
||||||
|
|
||||||
While preferred content expresses a preference, it can be overridden
|
While preferred content expresses a preference, it can be overridden
|
||||||
by simply using `git annex drop`. On the other hand, required content
|
by simply using `git annex drop`. On the other hand, required content
|
||||||
|
|
|
@ -22,7 +22,9 @@ git-annex branch. That tells other repositories about the proxy
|
||||||
configuration.
|
configuration.
|
||||||
|
|
||||||
Suppose, for example, that remote "work" has had this command run in
|
Suppose, for example, that remote "work" has had this command run in
|
||||||
it. Then git-annex will know about an additional remote, "work-foo".
|
it. Then after pulling from "work", git-annex will know about an
|
||||||
|
additional remote, "work-foo". That remote will be accessed using "work" as
|
||||||
|
a proxy. (This only works for remotes accessed over ssh.)
|
||||||
|
|
||||||
# OPTIONS
|
# OPTIONS
|
||||||
|
|
||||||
|
@ -31,6 +33,7 @@ it. Then git-annex will know about an additional remote, "work-foo".
|
||||||
# SEE ALSO
|
# SEE ALSO
|
||||||
|
|
||||||
[[git-annex]](1)
|
[[git-annex]](1)
|
||||||
|
[[git-annex-cluster]](1)
|
||||||
|
|
||||||
# AUTHOR
|
# AUTHOR
|
||||||
|
|
||||||
|
|
|
@ -1377,6 +1377,14 @@ repository, using [[git-annex-config]]. See its man page for a list.)
|
||||||
set in global git configuration.
|
set in global git configuration.
|
||||||
For details, see <https://git-annex.branchable.com/tuning/>.
|
For details, see <https://git-annex.branchable.com/tuning/>.
|
||||||
|
|
||||||
|
* `annex.cluster.<name>`
|
||||||
|
|
||||||
|
[[git-annex-cluster]] sets this to the UUID of a cluster, to
|
||||||
|
enable the local repository to act as a proxy to the cluster.
|
||||||
|
|
||||||
|
Note that cluster UUIDs are not the same as repository UUIDs,
|
||||||
|
and a repository UUID cannot be used here.
|
||||||
|
|
||||||
# CONFIGURATION OF REMOTES
|
# CONFIGURATION OF REMOTES
|
||||||
|
|
||||||
Remotes are configured using these settings in `.git/config`.
|
Remotes are configured using these settings in `.git/config`.
|
||||||
|
@ -1649,7 +1657,18 @@ Remotes are configured using these settings in `.git/config`.
|
||||||
* `remote.<name>.annex-proxy`
|
* `remote.<name>.annex-proxy`
|
||||||
|
|
||||||
Set to "true" to make the local repository able to act as a proxy to this
|
Set to "true" to make the local repository able to act as a proxy to this
|
||||||
remote. After configuring this, run [[git-annex-updateproxy](1) to store
|
remote.
|
||||||
|
|
||||||
|
After configuring this, run [[git-annex-updateproxy](1) to store
|
||||||
|
the new configuration in the git-annex branch.
|
||||||
|
|
||||||
|
* `remote.<name>.annex-cluster-node`
|
||||||
|
|
||||||
|
Set to the name of a cluster to make this remote be part of
|
||||||
|
the cluster. Names of multiple clusters can be separated by
|
||||||
|
whitespace to make a remote be part of more than one cluster.
|
||||||
|
|
||||||
|
After configuring this, run [[git-annex-updatecluster](1) to store
|
||||||
the new configuration in the git-annex branch.
|
the new configuration in the git-annex branch.
|
||||||
|
|
||||||
* `remote.<name>.annex-private`
|
* `remote.<name>.annex-private`
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue