url_for() function needs refactoring of admin flag

Bug #1186379 reported by Eric Peterson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Medium
David Lyle

Bug Description

the url_for() method accepts both an endpoint_type argument and an admin argument. Having one parameter (admin) replace the other paramter (endpoint_type) is confusing and requires extra code that should not be needed. I would propose the following:

1) if endpoint_type is specified, then that type must be returned. If the type cannot be found - raise exception.
   ( replace all the locations where admin=True to pass endpoint_type='adminURL')

2) if endpoint_type is not specified, then use:
      getattr(settings,'OPENSTACK_ENDPOINT_TYPE', 'publicURL')

3) if the endpoint from item #2 is not found, leave a hardcoded use of 'publicURL'

I believe this will simplify code, add some extra power for using the OPENSTACK_ENDPOINT_TYPE setting, and still function the same.

Revision history for this message
David Lyle (david-lyle) wrote :

The current use of the admin parameter vs endpoint_type needs improvement. I also think this needs refactoring due to keystone interface name changes in v3.

Changed in horizon:
status: New → Confirmed
assignee: nobody → David Lyle (david-lyle)
Changed in horizon:
importance: Undecided → Medium
milestone: none → havana-2
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/31724

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

Reviewed: https://review.openstack.org/31724
Committed: http://github.com/openstack/horizon/commit/3f19461a809e5f40b5703c7f7fb31dcd27574777
Submitter: Jenkins
Branch: master

commit 3f19461a809e5f40b5703c7f7fb31dcd27574777
Author: David Lyle <email address hidden>
Date: Tue Jun 4 17:16:26 2013 -0600

    Refactoring url_for to remove admin parameter

    Removed unused admin parameter that was unused and removed tests
    that were no longer necessary.

    Added an option configuration setting SECONDARY_ENDPOINT_TYPE that
    will be attempted if the OPENSTACK_ENDPOINT_TYPE does not exist
    in the service catalog for the desired service.

    The primary use case for this fix is in cloud configurations
    where Keystone does not return all endpoint types for each
    service, and only does so based on the user's privilege level.

    Example use case would be set OPENSTACK_ENDPOINT_TYPE to 'adminURL'
    and set SECONDARY_ENDPOINT_TYPE to 'publicURL'. If adminURL is not
    available to the user, then they get the publicURL back.

    If SECONDARY_ENDPOINT_TYPE is not set in the settings, then the
    current behavior is maintained.

    Fixes: bug #1186379

    Change-Id: Ieefb6ed5dd88e5c840ef6bad93ae87237a1b63f9

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: havana-2 → 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.