Comment 14 for bug 1378558

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

Reviewed: https://review.openstack.org/192215
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=6b9f019959e47221291ca1f4723f389e6c6cda93
Submitter: Jenkins
Branch: stable/juno

commit 6b9f019959e47221291ca1f4723f389e6c6cda93
Author: Janet Yu <email address hidden>
Date: Fri Mar 13 13:50:42 2015 -0700

    Fix addition of plugin panel to panel group

    Revert fix from bug #1329050, which adds a plugin panel to its dashboard's
    class. Adding a plugin panel to a dashboard whose class has its panels defined
    in a tuple will fail because the new plugin cannot be appended to the tuple.
    The code errors out before the panel gets added to the dashboard's panel list.
    However, at this point, the panel has already been registered with the
    dashboard. This causes Dashboard.get_panels() to see the panel in its registry
    but not in its panel groups. Consequently, the panel gets put in the "Other"
    panel group instead of its configured one, as described in bug #1378558.

    By not adding the the plugin panel to its dashboard's class, the panel gets
    added to its dashboard's panel list. Now the original issue from bug #1329050
    resurfaces. The root cause of that is that every time Dashboard._autodiscover()
    is called, it instantiates all its panel group classes, wiping out any panels
    previously added to any of the panel groups. Avoid this by always processing
    all the plugin panel groups before any of the plugin panels, which also ensures
    that the panel groups exist before their panels.

    Making this change exposed an issue where the Horizon URLs were being loaded
    twice during the plugin infrastructure's unit tests, causing plugin panels to
    be added multiple times to their dashboards. Fix that by removing the second,
    unnecessary call. Also create a second test plugin panel group and panel to
    test the scenarios described in the two bugs addressed here, adding two panel
    groups at a time.

    Change-Id: Id6a99c3ff18102c8f47431638d4dda98f14ec641
    Closes-Bug: 1378558
    (cherry picked from commit e2ef492311a427fe3b5b41a6df6bd9be5a22c174)
    (cherry picked from commit 5c1604275bfbe621e5e168f8ba1f937d308d6ab8)