Make the rugged related checks more robust
Problem to solve
In our gitlab instance, the git repositories are local but the unicorn process can not access them directly (due to local SELinux policy). Starting with 12.1, this throws an exception
NameError (uninitialized constant Errno::ACCESS
Did you mean? Errno::EACCES):
lib/gitlab/gitaly_client.rb:417:in `rescue in filesystem_id_from_disk'
lib/gitlab/gitaly_client.rb:413:in `filesystem_id_from_disk'
lib/gitlab/gitaly_client.rb:398:in `can_use_disk?'
lib/gitlab/git/rugged_impl/use_rugged.rb:11:in `use_rugged?'
lib/gitlab/git/rugged_impl/commit.rb:38:in `find_commit'
lib/gitlab/git/commit.rb:66:in `find'```
causing a 500 "Something went wrong" error.
I know that I can fix it by gitlab-rake gitlab:features:disable_rugged
but it would be nice when can_use_disk?
catches EACCESS
and similar situations. Semantically, it should return false
because due to EACCESS
the disk can not be used.