THT J2 template error - 'dict object' has no attribute 'ip_subnet'

Bug #1929835 reported by Harald Jensås
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
High
Harald Jensås

Bug Description

2021-05-27 14:23:34.490 533603 WARNING tripleoclient.v1.overcloud_deploy.DeployOvercloud [-] Error rendering template /home/centos/overcloud-deploy/my_overcloud/tripleo-heat-templates/network/external.yaml : 'dict object' has no attribute 'ip_subnet'
2021-05-27 14:23:34.491 533603 WARNING tripleoclient.v1.overcloud_deploy.DeployOvercloud [-] Traceback (most recent call last):
2021-05-27 14:23:34.491 533603 WARNING tripleoclient.v1.overcloud_deploy.DeployOvercloud [-] File "/home/centos/tripleo-heat-templates/tools/process-templates.py", line 98, in _j2_render_to_file
2021-05-27 14:23:34.491 533603 WARNING tripleoclient.v1.overcloud_deploy.DeployOvercloud [-] r_template = template.render(**j2_data)
2021-05-27 14:23:34.491 533603 WARNING tripleoclient.v1.overcloud_deploy.DeployOvercloud [-] File "/home/centos/venv/lib/python3.6/site-packages/jinja2/environment.py", line 1304, in render
2021-05-27 14:23:34.492 533603 WARNING tripleoclient.v1.overcloud_deploy.DeployOvercloud [-] self.environment.handle_exception()
2021-05-27 14:23:34.492 533603 WARNING tripleoclient.v1.overcloud_deploy.DeployOvercloud [-] File "/home/centos/venv/lib/python3.6/site-packages/jinja2/environment.py", line 925, in handle_exception
2021-05-27 14:23:34.492 533603 WARNING tripleoclient.v1.overcloud_deploy.DeployOvercloud [-] raise rewrite_traceback_stack(source=source)
2021-05-27 14:23:34.492 533603 WARNING tripleoclient.v1.overcloud_deploy.DeployOvercloud [-] File "<template>", line 1, in top-level template code
2021-05-27 14:23:34.493 533603 WARNING tripleoclient.v1.overcloud_deploy.DeployOvercloud [-] File "/home/centos/overcloud-deploy/my_overcloud/tripleo-heat-templates/network/network.j2", line 41, in top-level template code
2021-05-27 14:23:34.493 533603 WARNING tripleoclient.v1.overcloud_deploy.DeployOvercloud [-] {%- if ":" in network.ip_subnet or network.ipv6 or ipv6_override %}
2021-05-27 14:23:34.493 533603 WARNING tripleoclient.v1.overcloud_deploy.DeployOvercloud [-] jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'ip_subnet'
2021-05-27 14:23:34.493 533603 WARNING tripleoclient.v1.overcloud_deploy.DeployOvercloud [-]
2021-05-27 14:23:34.494 533603 WARNING tripleoclient.v1.overcloud_deploy.DeployOvercloud [-] During handling of the above exception, another exception occurred:
2021-05-27 14:23:34.494 533603 WARNING tripleoclient.v1.overcloud_deploy.DeployOvercloud [-]
2021-05-27 14:23:34.494 533603 WARNING tripleoclient.v1.overcloud_deploy.DeployOvercloud [-] Traceback (most recent call last):
2021-05-27 14:23:34.494 533603 WARNING tripleoclient.v1.overcloud_deploy.DeployOvercloud [-] File "/home/centos/tripleo-heat-templates/tools/process-templates.py", line 413, in <module>
2021-05-27 14:23:34.495 533603 WARNING tripleoclient.v1.overcloud_deploy.DeployOvercloud [-] network_data_path, (not opts.safe), opts.dry_run)
2021-05-27 14:23:34.495 533603 WARNING tripleoclient.v1.overcloud_deploy.DeployOvercloud [-] File "/home/centos/tripleo-heat-templates/tools/process-templates.py", line 303, in process_templates
2021-05-27 14:23:34.495 533603 WARNING tripleoclient.v1.overcloud_deploy.DeployOvercloud [-] out_f_path, overwrite, dry_run)
2021-05-27 14:23:34.495 533603 WARNING tripleoclient.v1.overcloud_deploy.DeployOvercloud [-] File "/home/centos/tripleo-heat-templates/tools/process-templates.py", line 103, in _j2_render_to_file
2021-05-27 14:23:34.496 533603 WARNING tripleoclient.v1.overcloud_deploy.DeployOvercloud [-] raise Exception(error_msg)
2021-05-27 14:23:34.496 533603 WARNING tripleoclient.v1.overcloud_deploy.DeployOvercloud [-] Exception: Error rendering template /home/centos/overcloud-deploy/my_overcloud/tripleo-heat-templates/network/external.yaml : 'dict object' has no attribute 'ip_subnet'

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-heat-templates (master)
Changed in tripleo:
status: Triaged → In Progress
Revision history for this message
Harald Jensås (harald-jensas) wrote :

NOTE: When I ran into this bug I installed tripleo-common and python-tripleoclient in a python virtual-env for testing. It is likely that I got jinja2==3.0.0 in the env. I.e this is a duplicate of https://bugs.launchpad.net/tripleo/+bug/1928145.

Changed in tripleo:
assignee: nobody → Harald Jensås (harald-jensas)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-heat-templates (master)

Reviewed: https://review.opendev.org/c/openstack/tripleo-heat-templates/+/793416
Committed: https://opendev.org/openstack/tripleo-heat-templates/commit/ed8bdde212ef6bd0af7e1438f7a74bda3f637e67
Submitter: "Zuul (22348)"
Branch: master

commit ed8bdde212ef6bd0af7e1438f7a74bda3f637e67
Author: Harald Jensås <email address hidden>
Date: Thu May 27 16:20:44 2021 +0200

    Set default for network.ip_subnet

    Jinja2 rendering failed when using network-v2 format
    because the network_data yaml does not include the
    ip_subnet key at the network level.

    Default network.ip_subnet to "" in the places were it
    does not have a the default already.

    These templates are not used with network-v2.

    Closes-Bug: #1929835
    Change-Id: Ib4d0551d99afd55fbb513f8c5050fb835dc332b4

Changed in tripleo:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-heat-templates 15.0.0

This issue was fixed in the openstack/tripleo-heat-templates 15.0.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-heat-templates (stable/wallaby)

Fix proposed to branch: stable/wallaby
Review: https://review.opendev.org/c/openstack/tripleo-heat-templates/+/824799

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-heat-templates (stable/wallaby)

Reviewed: https://review.opendev.org/c/openstack/tripleo-heat-templates/+/824799
Committed: https://opendev.org/openstack/tripleo-heat-templates/commit/b1b75cb7c3b76438b40458ce253db87590ac9b11
Submitter: "Zuul (22348)"
Branch: stable/wallaby

commit b1b75cb7c3b76438b40458ce253db87590ac9b11
Author: Harald Jensås <email address hidden>
Date: Thu May 27 16:20:44 2021 +0200

    Set default for network.ip_subnet

    Jinja2 rendering failed when using network-v2 format
    because the network_data yaml does not include the
    ip_subnet key at the network level.

    Default network.ip_subnet to "" in the places were it
    does not have a the default already.

    These templates are not used with network-v2.

    Closes-Bug: #1929835
    Change-Id: Ib4d0551d99afd55fbb513f8c5050fb835dc332b4
    (cherry picked from commit ed8bdde212ef6bd0af7e1438f7a74bda3f637e67)

tags: added: in-stable-wallaby
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.