tripleoclient fails rewriting resource_registry from j2 rendered environment

Bug #1671096 reported by James Slagle on 2017-03-08
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
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
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)"

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

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

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

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

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

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

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  Edit
Everyone can see this information.

Other bug subscribers