template-validate doesn't validate the same as stack-create

Bug #1467573 reported by Steven Hardy
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
Steven Hardy

Bug Description

https://review.openstack.org/#/c/132625/ introduced a path where we can fail-fast on create if a nested stack contains syntax errors, but currently this is not triggered when we do an explicit validate via template-validate instead of stack-create:

-bash-4.3$ cat tmp.yaml
heat_template_version: 2015-04-30

resources:
  Foo:
    type: validate_me.yaml
-bash-4.3$ cat validate_me.yaml
heat_template_version: 2015-04-30

resources:
  Foo:
-bash-4.3$ heat template-validate -f tmp.yaml
{
  "Description": "No description",
  "Parameters": {}
}
-bash-4.3$ echo $?
0
-bash-4.3$ heat stack-create foo -f tmp.yaml
ERROR: Failed to validate : : resources.Foo: : Each resource must contain a type key.

Steven Hardy (shardy)
Changed in heat:
assignee: nobody → Steven Hardy (shardy)
Changed in heat:
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Steven Hardy (shardy) wrote :

Actually it's not just nested stacks, there's a bunch of stuff we do in Stack.validate(), for example validation of outputs, which we don't do in the template-validate path - so we should probably just align these two code paths as far as is practical.

summary: - template-validate doesn't validate nested stacks
+ template-validate doesn't validate the same as stack-create
Changed in heat:
status: Triaged → In Progress
Changed in heat:
milestone: none → liberty-3
Changed in heat:
milestone: liberty-3 → liberty-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

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

Reviewed: https://review.openstack.org/223579
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=6cb3c7c7acc8139383c72f21a2e2f7fed58b665d
Submitter: Jenkins
Branch: master

commit 6cb3c7c7acc8139383c72f21a2e2f7fed58b665d
Author: Steven Hardy <email address hidden>
Date: Tue Sep 15 09:38:26 2015 +0100

    Add initial functional test for template-validate

    Prove basic template validation functionality, will provide additional
    confidence that subsequent rework to the internal implementation doesn't
    break the API.

    Change-Id: Ieb605ca66dfdf3e25b0a7a703df3015b817e615b
    Partial-Bug: #1467573

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/223580
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=99670fb1cc7ba7c9d8d779f13c9f7309b5d21328
Submitter: Jenkins
Branch: master

commit 99670fb1cc7ba7c9d8d779f13c9f7309b5d21328
Author: Steven Hardy <email address hidden>
Date: Tue Sep 15 12:01:05 2015 +0100

    Wire in files to template validate

    heatclient already supplies the files map, as for create/update
    but the API and RPC interfaces ignore it. So wire in the optional
    files map, which will enable moving to validation logic which
    more closely aligns with the create/update code.

    Change-Id: I32a4b8d8c02829398f4792fcb06783ce9233b645
    Co-Authored-By: Jay Dobies <email address hidden>
    Partial-Bug: 1467573

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/223737
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=99ae1702ffa6abcba909a2fb692b30163bcc8f5b
Submitter: Jenkins
Branch: master

commit 99ae1702ffa6abcba909a2fb692b30163bcc8f5b
Author: Steven Hardy <email address hidden>
Date: Tue Sep 15 18:59:09 2015 +0100

    Allow selectively disabling resource validation

    For template-validate to use the normal stack.validate code instead
    of reimplementing different validation logic, we need to disable
    the resource plugin validate() methods, because in nearly all cases
    these refer to resource property values, which don't exist at
    template-validate time, where parameters aren't mandatory.

    We do however want to ensure structural/syntax issues in the resource
    definition are caught as early as possible, so add a stack
    resource_validate attribute (defaulted to True) which enables selecting
    only the resource.Resource superclass validate logic, so we can defer
    the full value validation until create without maintaining completely
    separate logic.

    Change-Id: I501c8c36e923baa8d9b3f0395aaee41f7585ebb1
    Partial-Bug: #1467573

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/223581
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=ed64822d4d59877aa6826284b525641e638a186f
Submitter: Jenkins
Branch: master

commit ed64822d4d59877aa6826284b525641e638a186f
Author: Steven Hardy <email address hidden>
Date: Tue Sep 15 19:08:50 2015 +0100

    Convert validate_template validation path

    Currently the validation code for template-validate is different to
    that used for create/preview/update, which can lead to inconsistent
    results as the implementations have diverged.

    So instead align more closely with the actual validation, which
    should also enable easier validation of nested stacks which is
    currently not possible.

    Change-Id: Ibf93a170ab381a42a46ea414c3b134cbe0c3f232
    Closes-Bug: #1467573

Changed in heat:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in heat:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in heat:
milestone: liberty-rc1 → 5.0.0
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.