Skip to content

Commit

Permalink
Remove class-based import in the code repo
Browse files Browse the repository at this point in the history
Fixes bug 1167901

This commit also removes backslashes for line break.

Change-Id: Id26fdfd2af4862652d7270aec132d40662efeb96
  • Loading branch information
amotoki authored and openstack-gerrit committed Jun 13, 2013
1 parent 53adca5 commit b5a416a
Show file tree
Hide file tree
Showing 21 changed files with 340 additions and 408 deletions.
16 changes: 8 additions & 8 deletions quantumclient/common/clientmanager.py
Expand Up @@ -20,7 +20,7 @@

import logging

from quantumclient.client import HTTPClient
from quantumclient import client
from quantumclient.quantum import client as quantum_client


Expand Down Expand Up @@ -74,13 +74,13 @@ def __init__(self, token=None, url=None,

def initialize(self):
if not self._url:
httpclient = HTTPClient(username=self._username,
tenant_name=self._tenant_name,
password=self._password,
region_name=self._region_name,
auth_url=self._auth_url,
endpoint_type=self._endpoint_type,
insecure=self._insecure)
httpclient = client.HTTPClient(username=self._username,
tenant_name=self._tenant_name,
password=self._password,
region_name=self._region_name,
auth_url=self._auth_url,
endpoint_type=self._endpoint_type,
insecure=self._insecure)
httpclient.authenticate()
# Populate other password flow attributes
self._token = httpclient.auth_token
Expand Down
4 changes: 2 additions & 2 deletions quantumclient/common/command.py
Expand Up @@ -19,10 +19,10 @@
OpenStack base command
"""

from cliff.command import Command
from cliff import command


class OpenStackCommand(Command):
class OpenStackCommand(command.Command):
"""Base class for OpenStack commands
"""

Expand Down
17 changes: 6 additions & 11 deletions quantumclient/quantum/v2_0/floatingip.py
Expand Up @@ -19,14 +19,9 @@
import logging

from quantumclient.quantum import v2_0 as quantumv20
from quantumclient.quantum.v2_0 import CreateCommand
from quantumclient.quantum.v2_0 import DeleteCommand
from quantumclient.quantum.v2_0 import ListCommand
from quantumclient.quantum.v2_0 import QuantumCommand
from quantumclient.quantum.v2_0 import ShowCommand


class ListFloatingIP(ListCommand):
class ListFloatingIP(quantumv20.ListCommand):
"""List floating ips that belong to a given tenant."""

resource = 'floatingip'
Expand All @@ -37,15 +32,15 @@ class ListFloatingIP(ListCommand):
sorting_support = True


class ShowFloatingIP(ShowCommand):
class ShowFloatingIP(quantumv20.ShowCommand):
"""Show information of a given floating ip."""

resource = 'floatingip'
log = logging.getLogger(__name__ + '.ShowFloatingIP')
allow_names = False


class CreateFloatingIP(CreateCommand):
class CreateFloatingIP(quantumv20.CreateCommand):
"""Create a floating ip for a given tenant."""

resource = 'floatingip'
Expand Down Expand Up @@ -83,15 +78,15 @@ def args2body(self, parsed_args):
return body


class DeleteFloatingIP(DeleteCommand):
class DeleteFloatingIP(quantumv20.DeleteCommand):
"""Delete a given floating ip."""

log = logging.getLogger(__name__ + '.DeleteFloatingIP')
resource = 'floatingip'
allow_names = False


class AssociateFloatingIP(QuantumCommand):
class AssociateFloatingIP(quantumv20.QuantumCommand):
"""Create a mapping between a floating ip and a fixed ip."""

api = 'network'
Expand Down Expand Up @@ -130,7 +125,7 @@ def run(self, parsed_args):
_('Associated floatingip %s') % parsed_args.floatingip_id)


class DisassociateFloatingIP(QuantumCommand):
class DisassociateFloatingIP(quantumv20.QuantumCommand):
"""Remove a mapping from a floating ip to a fixed ip.
"""

Expand Down
16 changes: 6 additions & 10 deletions quantumclient/quantum/v2_0/network.py
Expand Up @@ -19,11 +19,7 @@
import logging

from quantumclient.common import exceptions
from quantumclient.quantum.v2_0 import CreateCommand
from quantumclient.quantum.v2_0 import DeleteCommand
from quantumclient.quantum.v2_0 import ListCommand
from quantumclient.quantum.v2_0 import ShowCommand
from quantumclient.quantum.v2_0 import UpdateCommand
from quantumclient.quantum import v2_0 as quantumv20


def _format_subnets(network):
Expand All @@ -34,7 +30,7 @@ def _format_subnets(network):
return ''


class ListNetwork(ListCommand):
class ListNetwork(quantumv20.ListCommand):
"""List networks that belong to a given tenant."""

# Length of a query filter on subnet id
Expand Down Expand Up @@ -101,14 +97,14 @@ def retrieve_list(self, parsed_args):
return super(ListExternalNetwork, self).retrieve_list(parsed_args)


class ShowNetwork(ShowCommand):
class ShowNetwork(quantumv20.ShowCommand):
"""Show information of a given network."""

resource = 'network'
log = logging.getLogger(__name__ + '.ShowNetwork')


class CreateNetwork(CreateCommand):
class CreateNetwork(quantumv20.CreateCommand):
"""Create a network for a given tenant."""

resource = 'network'
Expand Down Expand Up @@ -142,14 +138,14 @@ def args2body(self, parsed_args):
return body


class DeleteNetwork(DeleteCommand):
class DeleteNetwork(quantumv20.DeleteCommand):
"""Delete a given network."""

log = logging.getLogger(__name__ + '.DeleteNetwork')
resource = 'network'


class UpdateNetwork(UpdateCommand):
class UpdateNetwork(quantumv20.UpdateCommand):
"""Update network's information."""

log = logging.getLogger(__name__ + '.UpdateNetwork')
Expand Down
17 changes: 6 additions & 11 deletions quantumclient/quantum/v2_0/port.py
Expand Up @@ -20,11 +20,6 @@

from quantumclient.common import utils
from quantumclient.quantum import v2_0 as quantumv20
from quantumclient.quantum.v2_0 import CreateCommand
from quantumclient.quantum.v2_0 import DeleteCommand
from quantumclient.quantum.v2_0 import ListCommand
from quantumclient.quantum.v2_0 import ShowCommand
from quantumclient.quantum.v2_0 import UpdateCommand


def _format_fixed_ips(port):
Expand All @@ -34,7 +29,7 @@ def _format_fixed_ips(port):
return ''


class ListPort(ListCommand):
class ListPort(quantumv20.ListCommand):
"""List ports that belong to a given tenant."""

resource = 'port'
Expand All @@ -45,7 +40,7 @@ class ListPort(ListCommand):
sorting_support = True


class ListRouterPort(ListCommand):
class ListRouterPort(quantumv20.ListCommand):
"""List ports that belong to a given tenant, with specified router."""

resource = 'port'
Expand All @@ -71,14 +66,14 @@ def get_data(self, parsed_args):
return super(ListRouterPort, self).get_data(parsed_args)


class ShowPort(ShowCommand):
class ShowPort(quantumv20.ShowCommand):
"""Show information of a given port."""

resource = 'port'
log = logging.getLogger(__name__ + '.ShowPort')


class CreatePort(CreateCommand):
class CreatePort(quantumv20.CreateCommand):
"""Create a port for a given tenant."""

resource = 'port'
Expand Down Expand Up @@ -163,14 +158,14 @@ def args2body(self, parsed_args):
return body


class DeletePort(DeleteCommand):
class DeletePort(quantumv20.DeleteCommand):
"""Delete a given port."""

resource = 'port'
log = logging.getLogger(__name__ + '.DeletePort')


class UpdatePort(UpdateCommand):
class UpdatePort(quantumv20.UpdateCommand):
"""Update port's information."""

resource = 'port'
Expand Down
9 changes: 4 additions & 5 deletions quantumclient/quantum/v2_0/quota.py
Expand Up @@ -24,15 +24,14 @@
from quantumclient.common import exceptions
from quantumclient.common import utils
from quantumclient.quantum import v2_0 as quantumv20
from quantumclient.quantum.v2_0 import QuantumCommand


def get_tenant_id(tenant_id, client):
return (tenant_id if tenant_id else
client.get_quotas_tenant()['tenant']['tenant_id'])


class DeleteQuota(QuantumCommand):
class DeleteQuota(quantumv20.QuantumCommand):
"""Delete defined quotas of a given tenant."""

api = 'network'
Expand Down Expand Up @@ -64,7 +63,7 @@ def run(self, parsed_args):
return


class ListQuota(QuantumCommand, lister.Lister):
class ListQuota(quantumv20.QuantumCommand, lister.Lister):
"""List defined quotas of all tenants."""

api = 'network'
Expand Down Expand Up @@ -93,7 +92,7 @@ def get_data(self, parsed_args):
for s in info))


class ShowQuota(QuantumCommand, show.ShowOne):
class ShowQuota(quantumv20.QuantumCommand, show.ShowOne):
"""Show quotas of a given tenant
"""
Expand Down Expand Up @@ -140,7 +139,7 @@ def get_data(self, parsed_args):
return None


class UpdateQuota(QuantumCommand, show.ShowOne):
class UpdateQuota(quantumv20.QuantumCommand, show.ShowOne):
"""Define tenant's quotas not to use defaults."""

resource = 'quota'
Expand Down
22 changes: 8 additions & 14 deletions quantumclient/quantum/v2_0/router.py
Expand Up @@ -20,12 +20,6 @@

from quantumclient.common import utils
from quantumclient.quantum import v2_0 as quantumv20
from quantumclient.quantum.v2_0 import CreateCommand
from quantumclient.quantum.v2_0 import DeleteCommand
from quantumclient.quantum.v2_0 import ListCommand
from quantumclient.quantum.v2_0 import QuantumCommand
from quantumclient.quantum.v2_0 import ShowCommand
from quantumclient.quantum.v2_0 import UpdateCommand


def _format_external_gateway_info(router):
Expand All @@ -35,7 +29,7 @@ def _format_external_gateway_info(router):
return ''


class ListRouter(ListCommand):
class ListRouter(quantumv20.ListCommand):
"""List routers that belong to a given tenant."""

resource = 'router'
Expand All @@ -46,14 +40,14 @@ class ListRouter(ListCommand):
sorting_support = True


class ShowRouter(ShowCommand):
class ShowRouter(quantumv20.ShowCommand):
"""Show information of a given router."""

resource = 'router'
log = logging.getLogger(__name__ + '.ShowRouter')


class CreateRouter(CreateCommand):
class CreateRouter(quantumv20.CreateCommand):
"""Create a router for a given tenant."""

resource = 'router'
Expand Down Expand Up @@ -82,21 +76,21 @@ def args2body(self, parsed_args):
return body


class DeleteRouter(DeleteCommand):
class DeleteRouter(quantumv20.DeleteCommand):
"""Delete a given router."""

log = logging.getLogger(__name__ + '.DeleteRouter')
resource = 'router'


class UpdateRouter(UpdateCommand):
class UpdateRouter(quantumv20.UpdateCommand):
"""Update router's information."""

log = logging.getLogger(__name__ + '.UpdateRouter')
resource = 'router'


class RouterInterfaceCommand(QuantumCommand):
class RouterInterfaceCommand(quantumv20.QuantumCommand):
"""Based class to Add/Remove router interface."""

api = 'network'
Expand Down Expand Up @@ -151,7 +145,7 @@ def run(self, parsed_args):
_('Removed interface from router %s') % parsed_args.router_id)


class SetGatewayRouter(QuantumCommand):
class SetGatewayRouter(quantumv20.QuantumCommand):
"""Set the external network gateway for a router."""

log = logging.getLogger(__name__ + '.SetGatewayRouter')
Expand Down Expand Up @@ -187,7 +181,7 @@ def run(self, parsed_args):
_('Set gateway for router %s') % parsed_args.router_id)


class RemoveGatewayRouter(QuantumCommand):
class RemoveGatewayRouter(quantumv20.QuantumCommand):
"""Remove an external network gateway from a router."""

log = logging.getLogger(__name__ + '.RemoveGatewayRouter')
Expand Down

0 comments on commit b5a416a

Please sign in to comment.