duplicate __init__() in ExtensionResource

Bug #1266344 reported by Kun Huang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Kun Huang

Bug Description

Let's go in codes directly, to get resources from extension, the child class[0] has an __init__() to register itself, and the farther class [1]'s __init__() has already did this. If there are no some specified variables needed by child class, the child's __init__ could be removed. In <nova>/nova/api/openstack/compute/contrib/, nearly all of extensions class don't have such a duplicate __init__(). Removing the __init__() in child class could help keeping codes consistent and clean.

[0] https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/contrib/fixed_ips.py#L88
[1] https://github.com/openstack/nova/blob/master/nova/api/openstack/extensions.py#L63

Changed in nova:
assignee: nobody → Kun Huang (academicgareth)
Revision history for this message
Kun Huang (academicgareth) wrote :

For example, floating_ip_dns.py[3] uses __init__ correctly because it needs another variable and doesn't do the duplicate thing.

https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/contrib/floating_ip_dns.py#L289

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

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

Reviewed: https://review.openstack.org/65027
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=521a03bb67724ab545430ea891eb6d6d90b992f5
Submitter: Jenkins
Branch: master

commit 521a03bb67724ab545430ea891eb6d6d90b992f5
Author: Kun Huang <email address hidden>
Date: Thu Jan 2 23:37:37 2014 -0500

    remove redundant __init__() overwriting when getting ExtensionResources

    As described in #1266344, some of child class in
    <nova>/nova/api/openstack/compute/contrib/ has overwrited __init__()
    without specified needs. Removing that could help keeps codes clean and
    consistent (nearly all others don't overwrite __init__()).

    Change-Id: I87dfd9c1622bc8250f620ef591391a0e98573f78
    Closes-Bug: #1266344

Changed in nova:
status: In Progress → Fix Committed
Changed in nova:
milestone: none → icehouse-3
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: icehouse-3 → 2014.1
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.