Homebrew / homebrew-core

🍻 Default formulae for the missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
13.69k stars 12.4k forks source link

Ansible 4.6.0 is using faulty Jinja 3.0.1 #87026

Closed den-is closed 3 years ago

den-is commented 3 years ago

brew config output

HOMEBREW_VERSION: 3.2.15-49-g1eaf8db
ORIGIN: https://github.com/Homebrew/brew
HEAD: 1eaf8dbbec28e37d4f7cd7642287fa0ab58a6d86
Last commit: 28 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 9c73ca362d1c8550e0377e9091e8805ab03ca68d
Core tap last commit: 8 hours ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.wdcZ3UTWB7/org.macosforge.xquartz:0
HOMEBREW_EDITOR: vim
HOMEBREW_MAKE_JOBS: 16
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: 16-core 64-bit kabylake
Clang: 13.0.0 build 1300
Git: 2.33.0 => /usr/local/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 11.6-x86_64
CLT: 13.0.0.0.1.1630607135
Xcode: 13.0
XQuartz: 2.7.11 => /opt/X11

brew doctor output

not relevant

What were you trying to do (and why)?

Using ansible as my primary confiuration tool.

What happened (include all command output)?

Spend 2 days trying to figure out if why ansible.builtin.template puts "raw template" file copy, instead of rendered file. In other words: In destination you will see file that has all jinja syntaxis in place and is not rendered. Virtually it looks like instead of "tempalate", "copy" has been used.

Issue with nested loops got fixed in 3.0.2 https://jinja.palletsprojects.com/en/3.0.x/changes/#version-3-0-2 Everything has worked after installing ansible 4.6.0 with jinja 3.0.2 using pip

What did you expect to happen?

Get correctly rendered file.

Step-by-step reproduction instructions (by running brew commands)

render that template

{% set initial_cluster_string %}
{%- for host in groups['masters'] -%}
{% set etcd_node_ip %}
{%- if hostvars[host]['advertise_addr'] is defined -%}
{{ hostvars[host]['advertise_addr'] }}
{%- else -%}
{{ hostvars[host]['ansible_default_ipv4']['address'] }}
{%- endif -%}
{%- endset -%}
{{ hostvars[host]['ansible_fqdn'] }}={{ 'https' if etcd_tls else 'http' }}://{{ etcd_node_ip }}:2380{{ '' if loop.last else ',' }}
{%- endfor -%}
{% endset -%}

{{ initial_cluster_string }}

with this minimal variable set

groups:
  masters:
    node1: {}

etcd_tls: yes

hostvars:
  node1:
    advertise_addr: 10.10.10.10
    ansible_fqdn: node1.dev
    ansible_default_ipv4:
      address: 10.10.10.10
SMillerDev commented 3 years ago

Does ansible have a release that depends on 3.0.2?

den-is commented 3 years ago

@SMillerDev I have not intentionally installed 3.0.2 by myself. Rather pip has pulled it by itself during the v4.6.0 install. That means that ansbile has flexible requirements, that can be seen here ... version is not specified at all, just pulling "latest".

carlocab commented 3 years ago

Should be fixed in #87028.