salt.fileserver.gitfs

Git Fileserver Backend

With this backend, branches and tags in a remote git repository are exposed to salt as different environments.

To enable, add git to the fileserver_backend option in the Master config file.

fileserver_backend:
  - git

As of Salt 2014.7.0, the Git fileserver backend supports GitPython, pygit2, and dulwich to provide the Python interface to git. If more than one of these are present, the order of preference for which one will be chosen is the same as the order in which they were listed: pygit2, GitPython, dulwich (keep in mind, this order is subject to change).

An optional master config parameter (gitfs_provider) can be used to specify which provider should be used.

More detailed information on how to use gitfs can be found in the Gitfs Walkthrough.

注解

Minimum requirements

To use GitPython for gitfs requires a minimum GitPython version of 0.3.0, as well as the git CLI utility. Instructions for installing GitPython can be found here.

To use pygit2 for gitfs requires a minimum pygit2 version of 0.20.3. pygit2 0.20.3 requires libgit2 0.20.0. pygit2 and libgit2 are developed alongside one another, so it is recommended to keep them both at the same major release to avoid unexpected behavior. For example, pygit2 0.21.x requires libgit2 0.21.x, pygit2 0.22.x will require libgit2 0.22.x, etc.

To find stale refs, pygit2 additionally requires the git CLI utility to be installed.

salt.fileserver.gitfs.clear_cache()

Completely clear gitfs cache

salt.fileserver.gitfs.clear_lock(remote=None)

Clear update.lk

salt.fileserver.gitfs.dir_list(load)

返回一个在master所有目录的列表。

salt.fileserver.gitfs.envs(ignore_cache=False)

Return a list of refs that can be used as environments

salt.fileserver.gitfs.file_hash(load, fnd)

返回一个文件hash,hash类型在master配置文件中设置。

salt.fileserver.gitfs.file_list(load)

Return a list of all files on the file server in a specified environment (specified as a key within the load dict).

salt.fileserver.gitfs.file_list_emptydirs(load)

Return a list of all empty directories on the master

salt.fileserver.gitfs.find_file(path, tgt_env='base', **kwargs)

Find the first file to match the path and ref, read the file out of git and send the path to the newly cached file

salt.fileserver.gitfs.init()

Initialize remotes. This is only used by the master's pre-flight checks, and is not invoked by GitFS.

salt.fileserver.gitfs.lock(remote=None)

Place an update.lk

remote can either be a dictionary containing repo configuration information, or a pattern. If the latter, then remotes for which the URL matches the pattern will be locked.

salt.fileserver.gitfs.serve_file(load, fnd)

从一个基于接收到的文件中返回数据块

Return a dict of all symlinks based on a given path in the repo

salt.fileserver.gitfs.update()

Execute a git fetch on all of the repos