无法使用 gitfs 执行嵌入式 Saltstack 状态
Not able to execute embedded Saltstack state using gitfs
我正在使用 SaltStack 的“gitfs”功能来执行状态文件。
状态文件使用 "include" 功能嵌入存储库中的其他两个状态文件。
我的存储库具有以下层次结构:
salt
- dir1
- dir3 / init.sls
- dir4 / init.sls
- dir2
- dir5 / init.sls
我的主文件如下:
. . .
fileserver_backend:
- git
gitfs_remotes:
- https://username@bitbucket.org/path/to/repo.git
. . .
salt/dir1/dir3/init.sls 包含以下内容:
include:
- salt/dir2/dir5/init.sls
- salt/dir1/dir4/init.sls
. . .
重启salt-master然后执行
salt-运行 fileserver.file_list saltenv=base 后端=git
显示存储库中的所有文件。
但是在运行宁
salt '' state.apply salt.dir1.dir3 -l debug
我收到以下错误:
[ERROR ] Data passed to highstate outputter is not a valid highstate return: {'<minion-id>': ['Specified SLS salt/dir2/dir5/init.sls in saltenv base is not available on the salt master or through a configured fileserver', 'Specified SLS salt/dir1/dir4/init.sls in saltenv base is not available on the salt master or through a configured fileserver']}
我的系统配置如下:
$ salt --versions-report
Salt Version:
Salt: 2016.3.3
Dependency Versions:
cffi: Not Installed
cherrypy: 3.2.2
dateutil: 1.5
gitdb: 0.5.4
gitpython: 0.3.2 RC1
ioflo: Not Installed
Jinja2: 2.7.2
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: 0.9.1
msgpack-pure: Not Installed
msgpack-python: 0.3.0
mysql-python: 1.2.3
pycparser: Not Installed
pycrypto: 2.6.1
pygit2: Not Installed
Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
python-gnupg: Not Installed
PyYAML: 3.10
PyZMQ: 14.0.1
RAET: Not Installed
smmap: 0.8.2
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.5
System Versions:
dist: Ubuntu 14.04 trusty
machine: x86_64
release: 3.13.0-91-generic
system: Linux
version: Ubuntu 14.04 trusty
存储库在重新启动 salt-master 时缓存到“/var/cache/salt/master/gitfs/refs/base/salt”路径中。
但是我发现 "dir2/dir5/init/sls" 而不是 "dir2/dir5/init.sls"
What could be the reason for this issue?
问题很可能出现在您的 include
声明中。 Salt 的 include
模块对待 SLS 文件的方式类似于 Python 模块。例如,您可以将 SLS 文件 foo/bar/baz.sls
引用为 foo.bar.baz
.
此外,init.sls
文件得到特殊处理,使您能够将整个目录视为一个模块。例如,foo.bar.baz
将包括 foo/bar/baz.sls
或 foo/bar/baz/init.sls
(取决于它们中的哪一个实际存在)。
总之,您的 include
语句应如下所示:
include:
- salt.dir2.dir5
- salt.dir1.dir4
我正在使用 SaltStack 的“gitfs”功能来执行状态文件。 状态文件使用 "include" 功能嵌入存储库中的其他两个状态文件。
我的存储库具有以下层次结构:
salt
- dir1
- dir3 / init.sls
- dir4 / init.sls
- dir2
- dir5 / init.sls
我的主文件如下:
. . .
fileserver_backend:
- git
gitfs_remotes:
- https://username@bitbucket.org/path/to/repo.git
. . .
salt/dir1/dir3/init.sls 包含以下内容:
include:
- salt/dir2/dir5/init.sls
- salt/dir1/dir4/init.sls
. . .
重启salt-master然后执行 salt-运行 fileserver.file_list saltenv=base 后端=git 显示存储库中的所有文件。 但是在运行宁 salt '' state.apply salt.dir1.dir3 -l debug 我收到以下错误:
[ERROR ] Data passed to highstate outputter is not a valid highstate return: {'<minion-id>': ['Specified SLS salt/dir2/dir5/init.sls in saltenv base is not available on the salt master or through a configured fileserver', 'Specified SLS salt/dir1/dir4/init.sls in saltenv base is not available on the salt master or through a configured fileserver']}
我的系统配置如下:
$ salt --versions-report
Salt Version:
Salt: 2016.3.3
Dependency Versions:
cffi: Not Installed
cherrypy: 3.2.2
dateutil: 1.5
gitdb: 0.5.4
gitpython: 0.3.2 RC1
ioflo: Not Installed
Jinja2: 2.7.2
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: 0.9.1
msgpack-pure: Not Installed
msgpack-python: 0.3.0
mysql-python: 1.2.3
pycparser: Not Installed
pycrypto: 2.6.1
pygit2: Not Installed
Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
python-gnupg: Not Installed
PyYAML: 3.10
PyZMQ: 14.0.1
RAET: Not Installed
smmap: 0.8.2
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.5
System Versions:
dist: Ubuntu 14.04 trusty
machine: x86_64
release: 3.13.0-91-generic
system: Linux
version: Ubuntu 14.04 trusty
存储库在重新启动 salt-master 时缓存到“/var/cache/salt/master/gitfs/refs/base/salt”路径中。 但是我发现 "dir2/dir5/init/sls" 而不是 "dir2/dir5/init.sls"
What could be the reason for this issue?
问题很可能出现在您的 include
声明中。 Salt 的 include
模块对待 SLS 文件的方式类似于 Python 模块。例如,您可以将 SLS 文件 foo/bar/baz.sls
引用为 foo.bar.baz
.
此外,init.sls
文件得到特殊处理,使您能够将整个目录视为一个模块。例如,foo.bar.baz
将包括 foo/bar/baz.sls
或 foo/bar/baz/init.sls
(取决于它们中的哪一个实际存在)。
总之,您的 include
语句应如下所示:
include:
- salt.dir2.dir5
- salt.dir1.dir4