Remove duplication in get_resource for services

Bug #1258656 reported by Paul Michali
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Low
Paul Michali

Bug Description

In VPNaaS extension there is a code block in get_resources() that is very similar to other services (and with the additions being proposed for SSL VPN - two more cases).

Should consider moving this up into a common module (base.py?) to remove duplication (assuming the variations don't make that feasible).

The block is:

        for collection_name in RESOURCE_ATTRIBUTE_MAP:
            resource_name = plural_mapping.get(
                collection_name, collection_name[:-1])
            params = RESOURCE_ATTRIBUTE_MAP[collection_name]
            collection_name = collection_name.replace('_', '-')

            quota.QUOTAS.register_resource_by_name(resource_name)
            controller = base.create_resource(
                collection_name, resource_name, plugin, params,
                allow_pagination=cfg.CONF.allow_pagination,
                allow_sorting=cfg.CONF.allow_sorting)

            resource = extensions.ResourceExtension(
                collection_name,
                controller,
                path_prefix=constants.COMMON_PREFIXES[constants.VPN],
                attr_map=params)
            resources.append(resource)

Changed in neutron:
status: New → Confirmed
importance: Undecided → Low
tags: added: low-hanging-fruit
Paul Michali (pcm)
Changed in neutron:
assignee: nobody → Paul Michali (pcm)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

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

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

Reviewed: https://review.openstack.org/64676
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=18c0f0937534ee763216236728e43383b9abb51c
Submitter: Jenkins
Branch: master

commit 18c0f0937534ee763216236728e43383b9abb51c
Author: Paul Michali <email address hidden>
Date: Tue Dec 24 16:17:02 2013 -0500

    Remove dupl. for get_resources in adv. services

    There is duplication of logic related to creating API resources
    for advanced services extensions. Extracted the common logic
    out into a new module that can be used by the services.
    There are already UT cases in the services that exercises
    the logic, so no new tests were added.

    Change-Id: Ib52e2de6f215a1755f11a382dc4451a05ce3b147
    Closes-Bug: 1258656

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