indent: "The filter plugin 'ansible.builtin.indent' failed: unsupported operand type(s)"
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 debops/roles/fail2ban/templates/etc/fail2ban/jail.local.d/default.local.j2 开始,检查用于默认操作和自定义操作的两个 indent 过滤器。使用 Ansible core 2.19 重现报告的问题,然后检查模板是否正确处理操作值。两份操作列表都能在没有报告的类型错误的情况下渲染模板,即为完成。
由索引模型根据 Issue 内容生成。
描述
With Debops 3.4.1 and Ansible core 2.19.11 on Debian Trixie, I get the following error:
[ERROR]: Task failed: The filter plugin 'ansible.builtin.indent' failed: unsupported operand type(s) for +=: '_AnsibleTaggedInt' and 'str'
Task failed.
Origin: /home/mathieu/dev/ansible/.collections/ansible_collections/debops/debops/roles/fail2ban/tasks/main.yml:123:3
121 mode: '0755'
122
123 - name: Configure jail default variables
^ column 3
<<< caused by >>>
The filter plugin 'ansible.builtin.indent' failed: unsupported operand type(s) for +=: '_AnsibleTaggedInt' and 'str'
Origin: /home/mathieu/dev/ansible/.collections/ansible_collections/debops/debops/roles/fail2ban/templates/etc/fail2ban/jail.local.d/default.local.j2
fatal: [template-ubuntu-2604]: FAILED! => {"changed": false, "msg": "Task failed: The filter plugin 'ansible.builtin.indent' failed: unsupported operand type(s) for +=: '_AnsibleTaggedInt' an
d 'str'"}
I had to modify debops/roles/fail2ban/templates/etc/fail2ban/jail.local.d/default.local.j2:
@@ -30,13 +30,13 @@ position = {{ fail2ban_position }}
{% if fail2ban_default_actions is defined and fail2ban_default_actions %}
{% for name, commands in fail2ban_default_actions.items() %}
-{{ "%-14s" | format(name) }} = {{ commands | indent(17) }}
+{{ "%-14s" | format(name) }} = {{ commands | string | ansible.builtin.indent(width=17) }}
{% endfor %}
{% endif %}
{% if fail2ban_custom_actions is defined and fail2ban_custom_actions %}
{% for name, commands in fail2ban_custom_actions.items() %}
-{{ "%-14s" | format(name) }} = {{ commands | indent(17) }}
+{{ "%-14s" | format(name) }} = {{ commands | string | ansible.builtin.indent(width=17) }}
{% endfor %}
{% endif %}
- 主要语言
- Python
- 星标
- 1.4k
- 派生
- 374
- 平均合并
- 2 天 22 小时
- 30 天内合并 PR
- 47
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
debops/debops 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
相似的 Issue
-
Test: to_hijri() accepts datetime.datetime and uses only the date part可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭good first issue
难度 1/5 1 小时以内 新手友好度 95/100
omarelshamy25x/shamy-hijri#63 · 3 条评论 ·
维护者通常 1 天内回复
-
polish
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
521xueweihan/HelloGitHub#4729 ·
-
[Bug]: Score parser reads parts of scientific notation as valid scores可能已有人在做 @AshutoshSingh840 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
UKGovernmentBEIS/control-arena#992 ·
维护者通常 3 天内回复
-
难度 1/5 1 小时以内 新手友好度 92/100
mvalentsev/awesome-free-ai-coding#70 ·
维护者通常 1 天内回复