map_replace should allow noop colliding replacements

Bug #1652034 reported by Steven Hardy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
Steven Hardy

Bug Description

There is validation in the map_replace code which aims to avoid corruption of the input map when keys collide, however it's too strict when you want to do optional replacement, e.g consider:

heat_template_version: 2016-10-14

parameters:
  InternalApiNetName:
    default: internal_api
    description: The name of the internal API network.
    type: string
  ExternalNetName:
    default: external
    description: The name of the external network.
    type: string

resources:
  NetIpMapValue:
    type: OS::Heat::Value
    properties:
      type: json
      value:
        map_replace:
          - ctlplane: []
            external: []
          - keys:
              external: {get_param: ExternalNetName}
              internal_api: {get_param: InternalApiNetName}

outputs:
  net_ip_map:
    description: >
      A Hash containing a mapping of network names to assigned lists
      of IP addresses.
    value: {get_attr: [NetIpMapValue, value]}

This fails now, because the "external" key collides, but it should be allowed as it's a noop. We should still reject the case where ExternalNetName is e.g "ctlplane", but we should allow it when it's either "external", or any non-colliding name.

Steven Hardy (shardy)
Changed in heat:
milestone: none → ocata-3
status: New → Triaged
assignee: nobody → Steven Hardy (shardy)
importance: Undecided → Medium
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/414080

Changed in heat:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

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

commit c540293cfeeae6ff721e7fac59981f40f03bcf19
Author: Steven Hardy <email address hidden>
Date: Thu Dec 22 12:32:55 2016 +0000

    map_replace allow noop colliding replacements

    We should allow the case where the keys collide, but the
    replacement is the same as the current key (e.g a noop).

    This is useful when you want to do a map_replace based on a
    user parameter, then the default can be to do a noop replace
    but the user parameter may also be any other (non colliding)
    value.

    Change-Id: I8cc5761c219616b4f8c18b3f44c4bf864c5457f1
    Closes-Bug: #1652034

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

This issue was fixed in the openstack/heat 8.0.0.0b3 development milestone.

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

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on heat (stable/newton)

Change abandoned by Steven Hardy (<email address hidden>) on branch: stable/newton
Review: https://review.openstack.org/434185
Reason: Temporarily abandoning as this is blocking https://review.openstack.org/#/c/413626/

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

Reviewed: https://review.openstack.org/434185
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=0ff3659a5541b9a20b32185a0b3214bfedd67182
Submitter: Jenkins
Branch: stable/newton

commit 0ff3659a5541b9a20b32185a0b3214bfedd67182
Author: Steven Hardy <email address hidden>
Date: Thu Dec 22 12:32:55 2016 +0000

    map_replace allow noop colliding replacements

    We should allow the case where the keys collide, but the
    replacement is the same as the current key (e.g a noop).

    This is useful when you want to do a map_replace based on a
    user parameter, then the default can be to do a noop replace
    but the user parameter may also be any other (non colliding)
    value.

    Change-Id: I8cc5761c219616b4f8c18b3f44c4bf864c5457f1
    Closes-Bug: #1652034
    (cherry picked from commit c540293cfeeae6ff721e7fac59981f40f03bcf19)

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

This issue was fixed in the openstack/heat 7.0.3 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.