Neutron port resource fails to validate empty string

Bug #1528364 reported by Steven Hardy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Invalid
Medium
Unassigned

Bug Description

If you do this, the stack validation doesn't reject the empty string, and the create fails in a non-obvious way:

heat_template_version: 2013-05-23
parameters:
  net:
    type: string
    default: ""
resources:
  port:
    type: OS::Neutron::Port
    properties:
      network_id: {get_param: net}

| stack_status | CREATE_FAILED |
| stack_status_reason | Resource CREATE failed: BadRequest: resources.port: |
| | Unrecognized attribute(s) 'network'

In the engine log there's a backtrace where we've tried to pass the wrong "network" key with an empty string to neutron, instead of validating the network_id is invalid, which is fairly confusing when the empty string has been passed in via a user parameter or via a parent stack etc.

Steven Hardy (shardy)
Changed in heat:
status: New → Triaged
importance: Undecided → Medium
milestone: none → mitaka-2
Revision history for this message
Ukesh (ukeshkumar) wrote :

It seems, it is correct behaviour. If you pass an invalid network id/name also, the stack will fail.

If we want to validate an empty string, have to add constraints in the parameter.

Revision history for this message
Steven Hardy (shardy) wrote :

It's not correct behaviour, because we don't fail fast (an empty string can never be a valid neutron network name or uuid), and when we do fail it's with a non-obvious error not a clear "stack validation failed" error.

Revision history for this message
Ukesh (ukeshkumar) wrote :

I check in the latest devstack with the above heat template provided. I am getting the below error

ubuntu@ukesh-os:/opt/stack$ heat stack-create test1 -f test.yaml
ERROR: Property error: : resources.port.properties.network_id: : Multiple network matches found for name '', use an ID to be more specific.

Ukesh (ukeshkumar)
Changed in heat:
status: Triaged → Invalid
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.