Angular template cache breaks when the template contains backslashes

Bug #1617749 reported by Paulo Matias
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
High
Paulo Matias

Bug Description

The angular_escapes filter [1] currently does not handle backslashes ('\'), therefore templates containing this character are broken (or have their behaviour modified) when they are cached.

We faced this issue when deploying the LBaaSv2 dashboard [2], which uses ng-pattern="/^\d+$/" in multiple fields. This is transformed to ng-pattern=\"/^\d+$/\" when the pattern is cached (see [3]), which results in validator failures that block the usage of the LBaaSv2 dashboard.

Although the Horizon code base employs ng-pattern="/^[0-9]+$/" instead when a numeric validator is desired, we feel that not escaping the backslash is a dangerous behaviour which might cause other issues in the future.

We will send in a few minutes a patch to gerrit proposing a fix for this issue.

--

Expected behaviour: It should be possible to create a new load balancer via the dashboard when deploying Horizon together with the LBaaSv2 dashboard.

Actual behaviour: The validator fails on the "port" fields, which are mandatory to create a new load balancer. This blocks the creation of new load balancers through the dashboard.

Steps to reproduce:
* Deploy the environment
* Go to Project > Networks > Load Balancers
* Click on "Create Load Balancer"
* Try to fill a Port in the "Listener Details" tab

Environment:
* OpenStack-Ansible, master branch
* Multi-node deploy
* "neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPluginv2" included in "neutron_plugin_base"

--
References

[1] https://github.com/openstack/horizon/blob/107488f2f53f55ce2b727e52b5496db47ffc21ce/horizon/templatetags/angular.py#L57

[2] https://github.com/openstack/neutron-lbaas-dashboard/blob/c68b80b0bb9f89acd46da717b360b429efade43a/neutron_lbaas_dashboard/static/dashboard/project/lbaasv2/workflow/members/members.html#L73

[3] http://ix.io/1hqG

Changed in horizon:
assignee: nobody → Paulo Matias (paulo-matias)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

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

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

Reviewed: https://review.openstack.org/361741
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=d580adb4dd9337ca4e3b6eaeaefffdf3f215ac19
Submitter: Jenkins
Branch: master

commit d580adb4dd9337ca4e3b6eaeaefffdf3f215ac19
Author: Paulo Matias <email address hidden>
Date: Sat Aug 27 18:24:55 2016 -0300

    Escape blackslash in the angular_escapes filter

    Co-Authored-By: Tadeu Sampaio <email address hidden>
    Closes-Bug: #1617749
    Change-Id: Ic97c6f3b0e3c4c91323dcba82bfe43e252e16b1a

Changed in horizon:
status: In Progress → Fix Released
Revision history for this message
Rob Cresswell (robcresswell-deactivatedaccount) wrote :
Changed in horizon:
status: Fix Released → New
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

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

Changed in horizon:
assignee: Paulo Matias (paulo-matias) → Matt Borland (palecrow)
status: New → In Progress
Revision history for this message
Rob Cresswell (robcresswell-deactivatedaccount) wrote :

This needs to be fixed properly and tested please :)

Revision history for this message
Paulo Matias (paulo-matias) wrote :

Thanks, Rob. If we write some unit tests to ensure no double backslashes appear, would it be enough?

Changed in horizon:
assignee: Matt Borland (palecrow) → Paulo Matias (paulo-matias)
Changed in horizon:
milestone: none → newton-rc1
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

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

Reviewed: https://review.openstack.org/364554
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=5627065ee60f76ac231a88e1609c18cd5b6e145f
Submitter: Jenkins
Branch: master

commit 5627065ee60f76ac231a88e1609c18cd5b6e145f
Author: Paulo Matias <email address hidden>
Date: Thu Sep 1 15:57:34 2016 -0300

    Escape backslash in the angular_escapes filter

    Follow-up for Ic97c6f3b0e3c4c91323dcba82bfe43e252e16b1a.
    Supersedes Icbf97fea50183702aaacbe3b9be0d44a5797df9a.

    Change-Id: Idb58cebefab747f204e54ea6350db0852aec60f5
    Co-Authored-By: Matt Borland <email address hidden>
    Co-Authored-By: Tadeu Sampaio <email address hidden>
    Closes-Bug: #1617749

Changed in horizon:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on horizon (master)

Change abandoned by Matt Borland (<email address hidden>) on branch: master
Review: https://review.openstack.org/363154

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 10.0.0.0rc1

This issue was fixed in the openstack/horizon 10.0.0.0rc1 release candidate.

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.