Pools and Flavors are not populated if the resource exist

Bug #1396063 reported by Flavio Percoco
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Python client library for Zaqar
Fix Released
Low
Doraly Navarro

Bug Description

Flavor/Pool instances can be created by just passing the client and the name. They both check at construction time whether the resource exist in the server or not. If the resource doesn't exist, it'll attempt to create one, therefore it'd be necessary to pass all the required parameters. However, if the resource does exist, the optional parameters are not required at all.

The problem here is that the user would end up accessing non-populated attributes for both resources. See[0]

>> p = pool.Pool(client, 'my-pool') # my-pool exists in the server
>> p.weight is None # This shouldn't be True, it should contain the actual weight.
True

[0] https://git.openstack.org/cgit/openstack/python-zaqarclient/tree/zaqarclient/queues/v1/pool.py#n47

Changed in python-zaqarclient:
assignee: nobody → Doraly Navarro (doralynavarro)
importance: Undecided → Low
Changed in python-zaqarclient:
status: New → Triaged
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-zaqarclient (master)

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

Changed in python-zaqarclient:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

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

Reviewed: https://review.openstack.org/137398
Committed: https://git.openstack.org/cgit/openstack/python-zaqarclient/commit/?id=f5f35d4bfda73833d58cc3156962e87182be2f51
Submitter: Jenkins
Branch: master

commit f5f35d4bfda73833d58cc3156962e87182be2f51
Author: dynarro <email address hidden>
Date: Wed Nov 26 17:17:37 2014 +0100

    Gets 'pool' data if the resource exists

    Pool instances can be created by just passing the name. They both
    check at construction time whether the resource exist in the server or
    not. If the resource doesn't exist, it'll attempt to create one.

    Zaqarclient does not call anymore the 'pool_create' directly. It calls
    'pool_get' first, which ensures the resource exists. if not, a 'pool'
    will be created.

    Change-Id: I8f18b5031c80cfd5744ba3b0b7058654934f44b4
    Partial-Bug: #1396063

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/137635
Committed: https://git.openstack.org/cgit/openstack/python-zaqarclient/commit/?id=2bd784ed46e8f0c198b09370594345460d33a291
Submitter: Jenkins
Branch: master

commit 2bd784ed46e8f0c198b09370594345460d33a291
Author: dynarro <email address hidden>
Date: Thu Nov 27 14:12:15 2014 +0100

    Gets 'flavor' data if the resource exists

    Flavor instances can be created by just passing the name. it checks at
    construction time whether the resource exist in the server or not. If
    the resource doesn't exist, it'll attempt to create one.

    Zaqarclient does not call anymore the 'flavor_create' directly. It
    calls 'flavor_get' first, which ensures the resource exists. if not, a
    'flavor' will be created.

    Change-Id: Id78c79b7ead339cc64d57028eb49040fb67eb597
    Closes-Bug: #1396063
    Closes-Bug: #1394733

Changed in python-zaqarclient:
status: In Progress → Fix Committed
Changed in python-zaqarclient:
milestone: none → 0.2.0
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.