我正在使用SaltStack,並有與穀物相匹配的爪子文件。Salt的mine.get命令適用於CLI,但不適用於忍者模板
當我運行一個爪牙CLI一mine.get命令,它工作正常:
salt-call mine.get 'role:production-server' network.ip_addrs grain
返回主機及其IP地址的列表。
然而,在同僕從導致一個錯誤神社模板使用相同的命令:
{% for host, ip in salt['mine.get']('role:production-server', 'network.ip_addrs', expr_form='grain').items() %}
local:
Data failed to compile:
----------
Pillar failed to render with the following messages:
----------
Rendering SLS 'role_settings.staging-server' failed, render error:
Jinja error: 'master_uri'
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/utils/templates.py", line 265, in render_jinja_tmpl
output = template.render(**unicode_context)
File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 894, in render
return self.environment.handle_exception(exc_info, True)
File "<template>", line 25, in top-level template code
File "/usr/lib/python2.7/dist-packages/salt/modules/mine.py", line 182, in get
auth = _auth()
File "/usr/lib/python2.7/dist-packages/salt/modules/mine.py", line 24, in _auth
__context__['auth'] = salt.crypt.SAuth(__opts__)
File "/usr/lib/python2.7/dist-packages/salt/crypt.py", line 498, in __init__
self.crypticle = self.__authenticate()
File "/usr/lib/python2.7/dist-packages/salt/crypt.py", line 510, in __authenticate
self.opts.get('_safe_auth', True)
File "/usr/lib/python2.7/dist-packages/salt/crypt.py", line 341, in sign_in
if self.opts['master_ip'] not in self.opts['master_uri']:
KeyError: 'master_uri'
我茫然地是什麼原因造成這一點,因爲它的工作原理在命令行中,這似乎排除了與鹽主等
你運行'salt-call mine.get'之前刷新支柱數據嗎? 'SLS'role_settings.staging-server''看起來像什麼? – quanta
你有沒有設法解決這個問題?我現在正在遇到它。 – fromClouds
我還沒有做過這方面的工作,因爲其他的事情出現了,但AFAIK它仍然是一個問題:-S – elsmorian