Nova API uses different attribute name for list method

Bug #1434167 reported by stgleb
34
This bug affects 4 people
Affects Status Importance Assigned to Milestone
python-novaclient
Fix Released
High
melanie witt

Bug Description

method __repr__ from Host class in novaclient.v2.hosts.py cause an attribute error exception due to wrong name of attribute.
It uses self.host instead of self.host_name.

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/165905

Changed in python-novaclient:
assignee: nobody → stgleb (gstepanov)
status: New → In Progress
Revision history for this message
melanie witt (melwitt) wrote : Re: Wrong attribute name in nova client v2 host

Noting here that self.host is correct for all of the calls except "List hosts" according to api documentation:

http://developer.openstack.org/api-ref-compute-v2-ext.html#ext-os-hosts

So the fix isn't as straightforward as changing "host" to "host_name" unfortunately.

Changed in python-novaclient:
importance: Undecided → High
stgleb (gstepanov)
summary: - Wrong attribute name in nova client v2 host
+ Nova API uses different attribute name for list method
melanie witt (melwitt)
Changed in python-novaclient:
status: In Progress → Confirmed
assignee: stgleb (gstepanov) → nobody
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-novaclient (master)

Change abandoned by Kevin L. Mitchell (<email address hidden>) on branch: master
Review: https://review.openstack.org/165905
Reason: Idle for ~3 months. Please feel free to re-open if you get time to work on it.

Revision history for this message
melanie witt (melwitt) wrote :

I think the fix will involve creating a new class to represent a HostFromList resource, and specify that for the list calls, similar to what
https://review.openstack.org/#/c/168297/ did

Changed in python-novaclient:
assignee: nobody → Jude Augustine Job (judeaugustine-j)
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/248300

Changed in python-novaclient:
assignee: Jude Augustine Job (judeaugustine-j) → melanie witt (melwitt)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-novaclient (master)

Reviewed: https://review.openstack.org/248300
Committed: https://git.openstack.org/cgit/openstack/python-novaclient/commit/?id=c3dda7636cb7cf1d613c027703b88b41144dec32
Submitter: Jenkins
Branch: master

commit c3dda7636cb7cf1d613c027703b88b41144dec32
Author: melanie witt <email address hidden>
Date: Sat Nov 21 00:15:21 2015 +0000

    Fix repr of a host from a hosts.list()

    The os-hosts API uses different attribute names depending on
    whether the host was returned as part of a list or not.
    A host returned from 'show host' has the attribute "host"
    whereas a host returned from 'list hosts' has the attribute
    "host_name".

    This adds a host_name property to the Host class that will set the
    "host" attribute if necessary. Although this doesn't exactly mirror
    the responses coming back from nova api, it will make it easier for
    users to use the objects interchangeably for hosts.list() operations
    and hosts.update() operations, for example.

    Co-Authored-By: Chung Chih, Hung <email address hidden>

    Closes-Bug: #1434167

    Change-Id: I5c339bdd1ab867d972759ade9a10b86bfda1e70a

Changed in python-novaclient:
status: In Progress → Fix Committed
Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote : Fix included in openstack/python-novaclient 3.0.0

This issue was fixed in the openstack/python-novaclient 3.0.0 release.

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.