Project

General

Profile

Actions

Bug #17703

closed

Jinja2 vars.sys.ipv4 issue

Added by Alexander Brunhirl over 4 years ago. Updated over 4 years ago.

Status:
Resolved
Priority:
N/A
Assignee:
-
Category:
System techniques
Target version:
-
Severity:
UX impact:
User visibility:
Effort required:
Priority:
0
Name check:
To do
Fix check:
To do
Regression:

Description

Hi,

it seems like via Jinja2 the 'sys.ipv4[eth0]' is not properly resolved.

# cf-promises --show-vars  |grep sys.ipv4
default:sys.ipv4            192.168.1.22         inventory,source=agent,attribute_name=none
default:sys.ipv4[eth0]      192.168.1.22         source=agent
default:sys.ipv4[eth1]      10.0.1.22            source=agent
default:sys.ipv4[lo]        127.0.0.1            source=agent
        [...]
# rudder agent run -qu
        [...]
E| repaired      fileTemplate              Load Template from a fil| /root/ips.txt    | The copy of the file /var/rudder/configuration-repository/shared-files/ips.tpl from the policy server to /var/rudder/tmp/templates/ips.tpl was repaired
E| repaired      fileTemplate              Expand template           /root/ips.txt    | The expansion of the template /var/rudder/tmp/templates/ips.tpl in /root/ips.txt was repaired
        [...]
# cat /var/rudder/configuration-repository/shared-files/ips.tpl
eth0: {{ vars.sys.ipv4[eth0] }}
eth1: {{ vars.sys.ipv4[eth1] }}
# cat /root/ips.txt
#

Tried so far:

{{ vars.sys.ipv4[eth0] }}
{{ vars.sys.ipv4.eth0 }}
{{ vars.sys.ipv4'['eth0']' }}
{{ vars.sys.ipv4'[eth0]' }}

Best regards,
Alex

[1] https://jinja.palletsprojects.com/en/2.11.x/templates/#variables

Rudder agent: 6.0.5.release
Jinja2:
  • python36-jinja2-2.11.1-1.el7.noarch (CentOS 7)
  • python3-Jinja2-2.8-19.17.1.noarch (SLES12 SP4)
Actions

Also available in: Atom PDF