This causes the master to fail to start when there are fileserver config
issues, leading people quicker to the log to investigate, where they
will find a meaningful error message. This should it much quicker and
easier for users to realize there are gitfs/hgfs/svnfs fileserver config
problems.
Fixes#21021.
When only GitPython is installed, and no gitfs_provider is set, an error
about pygit2 not being available is logged. This should not happen, as
gitfs should just select the first available out of pygit2, gitpython,
and dulwich.
This fixes#17945 by suppressing the error.
Also rewrite salt.fileserver.gitfs.clear_lock() to accept a repo conf
dict instead of a pattern, so that locking and unlocking in
salt.fileserver.gitfs.update() can use the same code as the fileserver
runner.
Also rewrite salt.fileserver.svnfs.clear_lock() to accept a repo conf
dict instead of a pattern, so that locking and unlocking in
salt.fileserver.svnfs.update() can use the same code as the fileserver
runner.
Also rewrite salt.fileserver.hgfs.clear_lock() to accept a repo conf
dict instead of a pattern, so that locking and unlocking in
salt.fileserver.hgfs.update() can use the same code as the fileserver
runner.
Rather than using a subtractive approach (doing an os.listdir() and then
removing the stuff we don't want to delete), instead use an additive
approach and assemble a list of things we *do* want to delete. This
makes the function easier to read and maintain.
This loop is designed to remove the cache directories from old remotes.
shutil.rmtree() will throw an OSError, however, if run on something
other than a directory. This commit catches this exception and logs it.
Seeing this error in the log will be a reminder that some new file has
been added to the cachedir to be used by the FS backend, and that it
needs to be added to the exclusion logic above.
Older versions of hglib did not raise an exception when no refs were
found. This commit catches the exception, fixing a traceback that
prevents new remotes from ever being fetched for the first time.