Extension names for packages discovered by path are unintuitive.

Bug #1058366 reported by Adin Scannell
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-novaclient
Fix Released
Undecided
David Scannell

Bug Description

This is a minor issues for extensions. I've attached a super-simple patch that will tweak the names for extensions discovered by path. Below is the comment on the patch that explains it.

-- patch message --

Using novaclient with some extensions via python code, you might have an
invocation like this:

    extensions = shell.OpenStackComputeShell()._discover_extensions("1.1")
    novaclient = Client("1.1", user, apikey, project, authurl, extensions=extensions,
                        endpoint_type=shell.DEFAULT_NOVA_ENDPOINT_TYPE,
                        service_type=shell.DEFAULT_NOVA_SERVICE_TYPE)

If you have an extension like 'myextension.py' in the v1_1/contrib directory, you'll
end up with a very sensible attribute on the resulting novaclient object, i.e.

    novaclient.myextension

If you have a package distributed in the package myextension_python_novaclient_ext,
then it'll automatically be picked up as an extension (awesome!) but the name is not
as intuitive.

     novaclient.myextension_python_novaclient_ext

This patch simply changes this to use the Extension 'name' of myextension, even when
matching extensions found in packages. The possibility of collisions exists, but is
not really any more significant than before (where you might have different versions
of the same package installed in the system or heck, even a bizarrely named
'myextension_python_novaclient_ext.py' in the contrib/ directory).

Revision history for this message
Adin Scannell (amscanne) wrote :
Adin Scannell (amscanne)
security vulnerability: no → yes
Revision history for this message
Adin Scannell (amscanne) wrote :

Sorry about that, I'm not familiar with the launchpad interface I accidentally changed the information type. Doesn't look like it'll open a menu (no cursor change, etc.).

visibility: public → private
security vulnerability: yes → no
visibility: private → public
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-novaclient (master)

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

Changed in python-novaclient:
assignee: nobody → David Scannell (dscannell)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-novaclient (master)

Reviewed: https://review.openstack.org/21901
Committed: http://github.com/openstack/python-novaclient/commit/c0e85a84b0ef60047f9435ef5035d0f65e446847
Submitter: Jenkins
Branch: master

commit c0e85a84b0ef60047f9435ef5035d0f65e446847
Author: David Scannell <email address hidden>
Date: Wed Feb 13 13:47:45 2013 -0500

    Allow extensions to provide a name when discovered on the python path.

    Using novaclient with some extensions via python code, you might have an
    invocation like this:

        extensions = shell.OpenStackComputeShell()._discover_extensions("1.1")
        novaclient = Client("1.1", user, apikey, project, authurl, extensions=extensions,
                            endpoint_type=shell.DEFAULT_NOVA_ENDPOINT_TYPE,
                            service_type=shell.DEFAULT_NOVA_SERVICE_TYPE)

    If you have an extension like 'myextension.py' in the v1_1/contrib directory, you'll
    end up with a very sensible attribute on the resulting novaclient object, i.e.

        novaclient.myextension

    If you have a package distributed in the package myextension_python_novaclient_ext,
    then it'll automatically be picked up as an extension (awesome!) but the name is not
    as intuitive.

        novaclient.myextension_python_novaclient_ext

    This patch simply changes this to allow the Extension to provide a name for itself.
    The possibility of collisions exists, but is not really any more significant than
    before (where you might have different versions of the same package installed in the
    system or heck, even a bizarrely named 'myextension_python_novaclient_ext.py' in the
    contrib/ directory).

    Fixes bug 1058366

    Change-Id: Ie68463ffd7a939744e035b20fd50a7dc8da605de

Changed in python-novaclient:
status: In Progress → Fix Committed
Changed in python-novaclient:
status: Fix Committed → Fix Released
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.