Warn when users attempt to specify git_data_dirs with nested directories
From https://gitlab.com/gitlab-org/gitlab-ce/issues/53107#note_124494476, Gitaly tries to prevent users from using nested directories for Gitaly storage shards, but Omnibus actually interferes with that check.
Let's say you have this config:
git_data_dirs({
"default" => { "path" => "/var/opt/gitlab/git-data/repositories" },
"another-mount" => { "path" => "/var/opt/gitlab/git-data/repositories/test-mount" }
})
There are two directories in the config:
/var/opt/gitlab/git-data/repositories
/var/opt/gitlab/git-data/repositories/test-mount
The config that is generated by Omnibus actually results in:
[[storage]]
name = 'default'
path = '/var/opt/gitlab/git-data/repositories/repositories'
[[storage]]
name = 'another-mount'
path = '/var/opt/gitlab/git-data/repositories/test-mount/repositories'
If you look closely, repositories
is appended to each given path by Omnibus, resulting in the following paths:
/var/opt/gitlab/git-data/repositories/repositories
/var/opt/gitlab/git-data/repositories/test-mount/repositories
Gitaly has a start-up check that tries to prevent nested directories by checking whether one path is a subset of another. However, that check doesn't flag this as an error because /var/opt/gitlab/git-data/repositories/test-mount/repositories
does NOT look like a nested directory of /var/opt/gitlab/git-data/repositories/repositories
.
We might want to make Omnibus perform a sanity check that the given paths aren't nested within each other.