jinja2 - 失败:Jinja 变量“salt.utils.context.NamespacedDictWrapper 对象”没有属性“env”
问题描述
刚刚继承了一个盐实现,我遇到了一个我似乎无法弄清楚的错误。我有 5 个运行完美的仆从,但是当我添加第 6 个时,我收到以下错误:
Rendering SLS 'production:clientxyz.init' failed: Jinja variable 'salt.utils.context.NamespacedDictWrapper object' has no attribute 'env'
这看起来是特定于第 6 个仆从,因为所有其他仆从都成功运行。我可以对 minion 执行 test.ping,因此通信似乎正常。
以下是有关当前部署的一些详细信息:
盐奴才
Salt: 3000.3
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.4.2
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.8
libgit2: Not Installed
M2Crypto: Not Installed
Mako: 1.0.3
msgpack-pure: Not Installed
msgpack-python: 0.6.2
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.12 (default, Apr 15 2020, 17:07:12)
python-gnupg: 0.3.8
PyYAML: 3.11
PyZMQ: 15.2.0
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.1.4
System Versions:
dist: Ubuntu 16.04 xenial
locale: UTF-8
machine: x86_64
release: 4.4.0-1109-aws
system: Linux
version: Ubuntu 16.04 xenial
盐师傅
Salt Version:
Salt: 3000.2
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.6.1
docker-py: Not Installed
gitdb: 2.0.3
gitpython: 2.1.8
Jinja2: 2.10
libgit2: 0.26.0
M2Crypto: Not Installed
Mako: 1.0.7
msgpack-pure: Not Installed
msgpack-python: 0.5.6
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: 0.26.2
Python: 2.7.17 (default, Apr 15 2020, 17:20:14)
python-gnupg: 0.4.1
PyYAML: 3.12
PyZMQ: 16.0.2
smmap: 2.0.3
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.2.5
System Versions:
dist: Ubuntu 18.04 bionic
locale: UTF-8
machine: x86_64
release: 5.3.0-1023-aws
system: Linux
version: Ubuntu 18.04 bionic
客户端xyz.init
clientxyz_group:
group.present:
- name: clientxyz
- system: True
clientxyz_user:
user.present:
- name: clientxyz
- groups:
- clientxyz
require:
- group: clientxyz_group
{% if pillar['env'] == 'prod' %}
/opt/prod/clientxyz/.env_file.prod:
file:
- managed
- template: jinja
- source: salt://env_templates/production/files/.env_file.prod
{% endif %}
顶部.sls
'*': - 数据 - 文件哈希 - global_vars # 生产 '客户XYZ: - 客户xyz - 生产共享 “客户ABC”: - 客户abc - 生产共享
客户端xyz.sls
#!yaml|gpg fb_files: /var/log/syslog: 客户端xyz 环境:产品 命名空间:生产 订阅: DB_HOST: <数据库主机名> DB_PORT:5432 DB_USER:clientxyz_user DB_NAME:clientxyz_database DB_PWD: | -----开始PGP消息----- 已删除加密密码 -----结束 PGP 消息-----
我不知道这里面还包括什么,idk,如果这是master和minion之间的版本问题,或者那个'env'错误是指clientxyz.init中的piller ['env']引用。有点不知所措,任何帮助将不胜感激!
解决方案
事实证明这是 gitlab 和部署密钥的问题。Minion 正在运行 repo 的缓存版本,并且没有使用最新的支柱进行更新。
推荐阅读
- vsto - 在 Word VSTO 中创建自己的自定义 RibbonControl 类型
- python - 使用朴素贝叶斯训练模型
- mysql - Sql将值从一列移动到两个不同的列
- c# - 没有 CheckNetIsolation.exe LoopbackExempt 的 UWP C# .Net 套接字服务器
- state - AgGrid 检测列/过滤器/排序事件的变化
- javascript - 从另一个组件更改自定义组件的 css 类
- foreach - SwiftUI:删除列表的最后一项并切换到另一个选项卡视图后出现“致命错误:索引超出范围”
- javascript - 将 botkit 框架部署到 azure 并在网络聊天中进行测试返回 502
- replaykit - 将 ReplayKit 与 MacCatalyst 一起使用
- android - 我如何将多个数据添加到 firebase 实时数据库上的同一个令牌