hot str_replace behaves differently to Fn::Replace

Bug #1228640 reported by Steve Baker
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
High
Steve Baker

Bug Description

str_replace uses python templates, whereas Fn::Replace uses python string.replace.

During the original review for Fn::Replace, python templates were decided against because $ would often need double-escaping in shell scripts.
https://review.openstack.org/#/c/31736/

As a fix, str_replace should switch to using string.replace

description: updated
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/47772

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/47772
Committed: http://github.com/openstack/heat/commit/f424d6f6c3fec5a534c7850551ad62b4f055b606
Submitter: Jenkins
Branch: master

commit f424d6f6c3fec5a534c7850551ad62b4f055b606
Author: Steve Baker <email address hidden>
Date: Mon Sep 23 13:41:32 2013 +1200

    HOT str_replace to use string.replace, not string.Template

    str_replace uses python templates, whereas Fn::Replace uses python
    string.replace.

    During the original review for Fn::Replace, python templates were
    decided against because $ would often need double-escaping in shell scripts.
    https://review.openstack.org/#/c/31736/

    Having different behaviours between Fn::Replace and str_replace will
    add complication for users migrating existing templates to HOT.

    Another advantage of using straight string replacement is seen when
    the template generates a executable script. In this case it is generally
    possible to write a template that can also be executed directly in a
    dev/test environment. This would often not be possible if the template
    format required placeholders to be prefixed with a $.

    Whatever behaviour exists when Havana is release will have to be
    supported indefinitely so now is the time to decide if this is going
    to be fixed.

    Closes-Bug: #1228640
    Change-Id: I72879b374a3c61dfe0e4004251ab709d914f2e25

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: havana-rc1 → 2013.2
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.