tripleoclient fails rewriting resource_registry from j2 rendered environment

Bug #1671096 reported by James Slagle
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
High
James Slagle

Bug Description

If you specify a rendered environment file name that comes from a j2 template with -e on the command line like so:

openstack overcloud deploy ... -e /path/to/some/environment/my-environment.yaml ...

where /path/to/some/environment/my-environment.yaml comes from /path/to/some/environment/my-environment.j2.yaml, if there is any exception loading the rendered environment you hit this exception block:

https://github.com/openstack/python-tripleoclient/blob/master/tripleoclient/v1/overcloud_deploy.py#L143

where tripleoclient will attempt to rewrite file paths from their absolution location to the new tmp dir location that has been downloaded from swift.

However, this fails with an error with a "No such file or directory" error triggered by this line:

https://github.com/openstack/python-tripleoclient/blob/master/tripleoclient/v1/overcloud_deploy.py#L143

which is:
 with open(abs_env_path, 'r') as f:

since the the abs_env_path doesn't exist as it was rendered from a template.

In this case, I think we just need to use env_path in that line.

Changed in tripleo:
status: New → In Progress
importance: Undecided → High
assignee: nobody → James Slagle (james-slagle)
milestone: none → pike-1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-tripleoclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/443131

Revision history for this message
James Slagle (james-slagle) wrote :
Revision history for this message
James Slagle (james-slagle) wrote :

another way to trigger this bug is if you have put the wrong path to a resource in the environment j2 template. the rendered environment will fail to load and then hit this exception block. In that case, you don't even see the error that caused the environment to fail to load to begin with as you immediately hit the bug with the "with open(abs_env_path)"

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-tripleoclient (master)

Change abandoned by Emilien Macchi (<email address hidden>) on branch: master
Review: https://review.openstack.org/443131

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-tripleoclient (master)

Reviewed: https://review.openstack.org/443131
Committed: https://git.openstack.org/cgit/openstack/python-tripleoclient/commit/?id=9bfd6c21a7648e945576ce025ecc8e7733bee93c
Submitter: Jenkins
Branch: master

commit 9bfd6c21a7648e945576ce025ecc8e7733bee93c
Author: James Slagle <email address hidden>
Date: Wed Mar 8 08:36:58 2017 -0500

    Use tmp env path when rewriting absolute resource paths

    When rewriting absolute resource paths from a resource_registry that
    failed to load due to missing resources (one case being where those
    resources are rendered j2), then we should refer to the initial
    environemnt that failed to load by the tmp path.

    This is required since itself may have been rendered from j2. In such a
    case, the environment doesn't exist under the absolute template root
    path as it's not been rendered to that location.

    Change-Id: Ib681729cc2728ca4b0486c14166b6b702edfcaab
    Closes-Bug: #1671096

Changed in tripleo:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-tripleoclient (stable/ocata)

Fix proposed to branch: stable/ocata
Review: https://review.openstack.org/450026

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-tripleoclient (stable/ocata)

Reviewed: https://review.openstack.org/450026
Committed: https://git.openstack.org/cgit/openstack/python-tripleoclient/commit/?id=92c6fd12780366447cc845e533c2231a5ff76c0e
Submitter: Jenkins
Branch: stable/ocata

commit 92c6fd12780366447cc845e533c2231a5ff76c0e
Author: James Slagle <email address hidden>
Date: Wed Mar 8 08:36:58 2017 -0500

    Use tmp env path when rewriting absolute resource paths

    When rewriting absolute resource paths from a resource_registry that
    failed to load due to missing resources (one case being where those
    resources are rendered j2), then we should refer to the initial
    environemnt that failed to load by the tmp path.

    This is required since itself may have been rendered from j2. In such a
    case, the environment doesn't exist under the absolute template root
    path as it's not been rendered to that location.

    Change-Id: Ib681729cc2728ca4b0486c14166b6b702edfcaab
    Closes-Bug: #1671096
    (cherry picked from commit 9bfd6c21a7648e945576ce025ecc8e7733bee93c)

tags: added: in-stable-ocata
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-tripleoclient 7.0.0

This issue was fixed in the openstack/python-tripleoclient 7.0.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-tripleoclient 6.2.0

This issue was fixed in the openstack/python-tripleoclient 6.2.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-tripleoclient (stable/newton)

Fix proposed to branch: stable/newton
Review: https://review.openstack.org/548245

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-tripleoclient (stable/newton)

Reviewed: https://review.openstack.org/548245
Committed: https://git.openstack.org/cgit/openstack/python-tripleoclient/commit/?id=9e035eb11b5a44b4852fcd8485748d424b7df640
Submitter: Zuul
Branch: stable/newton

commit 9e035eb11b5a44b4852fcd8485748d424b7df640
Author: James Slagle <email address hidden>
Date: Wed Mar 8 08:36:58 2017 -0500

    Use tmp env path when rewriting absolute resource paths

    When rewriting absolute resource paths from a resource_registry that
    failed to load due to missing resources (one case being where those
    resources are rendered j2), then we should refer to the initial
    environemnt that failed to load by the tmp path.

    This is required since itself may have been rendered from j2. In such a
    case, the environment doesn't exist under the absolute template root
    path as it's not been rendered to that location.

    Change-Id: Ib681729cc2728ca4b0486c14166b6b702edfcaab
    Closes-Bug: #1671096
    (cherry picked from commit 9bfd6c21a7648e945576ce025ecc8e7733bee93c)
    (cherry picked from commit 92c6fd12780366447cc845e533c2231a5ff76c0e)

tags: added: in-stable-newton
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-tripleoclient 5.4.6

This issue was fixed in the openstack/python-tripleoclient 5.4.6 release.

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.