Skip to content

Commit

Permalink
rename neutron to tacker
Browse files Browse the repository at this point in the history
Change-Id: I1d7c0729d387827e8d4355db9f4dccb265c2ec32
  • Loading branch information
yamahata committed Jul 4, 2014
1 parent 066bddc commit 14eeda8
Show file tree
Hide file tree
Showing 39 changed files with 319 additions and 284 deletions.
Empty file.
Empty file.
Empty file.
Empty file removed neutronclient/v2_0/__init__.py
Empty file.
File renamed without changes.
12 changes: 6 additions & 6 deletions neutronclient/client.py → tackerclient/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
from keystoneclient import access
import requests

from neutronclient.common import exceptions
from neutronclient.common import utils
from neutronclient.openstack.common.gettextutils import _
from tackerclient.common import exceptions
from tackerclient.common import utils
from tackerclient.openstack.common.gettextutils import _

_logger = logging.getLogger(__name__)

if os.environ.get('NEUTRONCLIENT_DEBUG'):
if os.environ.get('TACKERCLIENT_DEBUG'):
ch = logging.StreamHandler()
_logger.setLevel(logging.DEBUG)
_logger.addHandler(ch)
Expand All @@ -44,7 +44,7 @@
class HTTPClient(object):
"""Handles the REST calls and responses, include authn."""

USER_AGENT = 'python-neutronclient'
USER_AGENT = 'python-tackerclient'

def __init__(self, username=None, user_id=None,
tenant_name=None, tenant_id=None,
Expand Down Expand Up @@ -242,7 +242,7 @@ def _get_endpoint_url(self):
try:
resp, body = self._cs_request(url, "GET")
except exceptions.Unauthorized:
# rollback to authenticate() to handle case when neutron client
# rollback to authenticate() to handle case when tacker client
# is initialized just before the token is expired
self.authenticate()
return self.endpoint_url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import gettext

t = gettext.translation('neutronclient', fallback=True)
t = gettext.translation('tackerclient', fallback=True)
try:
ugettext = t.ugettext # Python 2
except AttributeError:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

import logging

from neutronclient import client
from neutronclient.neutron import client as neutron_client
from tackerclient import client
from tackerclient.tacker import client as tacker_client


LOG = logging.getLogger(__name__)
Expand All @@ -44,10 +44,7 @@ def __get__(self, instance, owner):
class ClientManager(object):
"""Manages access to API clients, including authentication.
"""
neutron = ClientCache(neutron_client.make_client)
# Provide support for old quantum commands (for example
# in stable versions)
quantum = neutron
tacker = ClientCache(tacker_client.make_client)

def __init__(self, token=None, url=None,
auth_url=None,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@


EXT_NS = '_extension_ns'
XML_NS_V20 = 'http://openstack.org/quantum/api/v2.0'
XML_NS_V10 = 'http://openstack.org/tacker/api/v1.0'
XSI_NAMESPACE = "http://www.w3.org/2001/XMLSchema-instance"
XSI_ATTR = "xsi:nil"
XSI_NIL_ATTR = "xmlns:xsi"
TYPE_XMLNS = "xmlns:quantum"
TYPE_ATTR = "quantum:type"
TYPE_XMLNS = "xmlns:tacker"
TYPE_ATTR = "tacker:type"
VIRTUAL_ROOT_KEY = "_v_root"
ATOM_NAMESPACE = "http://www.w3.org/2005/Atom"
ATOM_XMLNS = "xmlns:atom"
Expand All @@ -33,11 +33,6 @@
TYPE_LIST = "list"
TYPE_DICT = "dict"

PLURALS = {'networks': 'network',
'ports': 'port',
'subnets': 'subnet',
'dns_nameservers': 'dns_nameserver',
'host_routes': 'host_route',
'allocation_pools': 'allocation_pool',
'fixed_ips': 'fixed_ip',
'extensions': 'extension'}
PLURALS = {'templates': 'template',
'devices': 'device',
'services': 'service'}
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@
# License for the specific language governing permissions and limitations
# under the License.

from neutronclient.common import _
from tackerclient.common import _

"""
Neutron base exception handling.
Tacker base exception handling.
Exceptions are classified into three categories:
* Exceptions corresponding to exceptions from neutron server:
* Exceptions corresponding to exceptions from tacker server:
This type of exceptions should inherit one of exceptions
in HTTP_EXCEPTION_MAP.
* Exceptions from client library:
This type of exceptions should inherit NeutronClientException.
This type of exceptions should inherit TackerClientException.
* Exceptions from CLI code:
This type of exceptions should inherit NeutronCLIError.
This type of exceptions should inherit TackerCLIError.
"""


class NeutronException(Exception):
"""Base Neutron Exception
class TackerException(Exception):
"""Base Tacker Exception
To correctly use this class, inherit from it and define
a 'message' property. That message will get printf'd
Expand All @@ -52,8 +52,8 @@ def __str__(self):
return self._error_string


class NeutronClientException(NeutronException):
"""Base exception which exceptions from Neutron are mapped into.
class TackerClientException(TackerException):
"""Base exception which exceptions from Tacker are mapped into.
NOTE: on the client side, we use different exception types in order
to allow client library users to handle server exceptions in try...except
Expand All @@ -63,39 +63,39 @@ class NeutronClientException(NeutronException):
def __init__(self, message=None, **kwargs):
if 'status_code' in kwargs:
self.status_code = kwargs['status_code']
super(NeutronClientException, self).__init__(message, **kwargs)
super(TackerClientException, self).__init__(message, **kwargs)


# Base exceptions from Neutron
# Base exceptions from Tacker

class BadRequest(NeutronClientException):
class BadRequest(TackerClientException):
status_code = 400


class Unauthorized(NeutronClientException):
class Unauthorized(TackerClientException):
status_code = 401
message = _("Unauthorized: bad credentials.")


class Forbidden(NeutronClientException):
class Forbidden(TackerClientException):
status_code = 403
message = _("Forbidden: your credentials don't give you access to this "
"resource.")


class NotFound(NeutronClientException):
class NotFound(TackerClientException):
status_code = 404


class Conflict(NeutronClientException):
class Conflict(TackerClientException):
status_code = 409


class InternalServerError(NeutronClientException):
class InternalServerError(TackerClientException):
status_code = 500


class ServiceUnavailable(NeutronClientException):
class ServiceUnavailable(TackerClientException):
status_code = 503


Expand All @@ -110,9 +110,9 @@ class ServiceUnavailable(NeutronClientException):
}


# Exceptions mapped to Neutron server exceptions
# Exceptions mapped to Tacker server exceptions
# These are defined if a user of client library needs specific exception.
# Exception name should be <Neutron Exception Name> + 'Client'
# Exception name should be <Tacker Exception Name> + 'Client'
# e.g., NetworkNotFound -> NetworkNotFoundClient

class NetworkNotFoundClient(NotFound):
Expand Down Expand Up @@ -143,7 +143,7 @@ class OverQuotaClient(Conflict):
pass


# TODO(amotoki): It is unused in Neutron, but it is referred to
# TODO(amotoki): It is unused in Tacker, but it is referred to
# in Horizon code. After Horizon code is updated, remove it.
class AlreadyAttachedClient(Conflict):
pass
Expand All @@ -160,64 +160,64 @@ class ExternalIpAddressExhaustedClient(BadRequest):
# Exceptions from client library

class NoAuthURLProvided(Unauthorized):
message = _("auth_url was not provided to the Neutron client")
message = _("auth_url was not provided to the Tacker client")


class EndpointNotFound(NeutronClientException):
class EndpointNotFound(TackerClientException):
message = _("Could not find Service or Region in Service Catalog.")


class EndpointTypeNotFound(NeutronClientException):
class EndpointTypeNotFound(TackerClientException):
message = _("Could not find endpoint type %(type_)s in Service Catalog.")


class AmbiguousEndpoints(NeutronClientException):
class AmbiguousEndpoints(TackerClientException):
message = _("Found more than one matching endpoint in Service Catalog: "
"%(matching_endpoints)")


class RequestURITooLong(NeutronClientException):
class RequestURITooLong(TackerClientException):
"""Raised when a request fails with HTTP error 414."""

def __init__(self, **kwargs):
self.excess = kwargs.get('excess', 0)
super(RequestURITooLong, self).__init__(**kwargs)


class ConnectionFailed(NeutronClientException):
message = _("Connection to neutron failed: %(reason)s")
class ConnectionFailed(TackerClientException):
message = _("Connection to tacker failed: %(reason)s")


class SslCertificateValidationError(NeutronClientException):
class SslCertificateValidationError(TackerClientException):
message = _("SSL certificate validation has failed: %(reason)s")


class MalformedResponseBody(NeutronClientException):
class MalformedResponseBody(TackerClientException):
message = _("Malformed response body: %(reason)s")


class InvalidContentType(NeutronClientException):
class InvalidContentType(TackerClientException):
message = _("Invalid content type %(content_type)s.")


# Command line exceptions

class NeutronCLIError(NeutronException):
class TackerCLIError(TackerException):
"""Exception raised when command line parsing fails."""
pass


class CommandError(NeutronCLIError):
class CommandError(TackerCLIError):
pass


class UnsupportedVersion(NeutronCLIError):
class UnsupportedVersion(TackerCLIError):
"""Indicates that the user is trying to use an unsupported
version of the API
"""
pass


class NeutronClientNoUniqueMatch(NeutronCLIError):
class TackerClientNoUniqueMatch(TackerCLIError):
message = _("Multiple %(resource)s matches found for name '%(name)s',"
" use an ID to be more specific.")
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@
# under the License.
#
###
### Codes from neutron wsgi
### Codes from tacker wsgi
###

import logging

from xml.etree import ElementTree as etree
from xml.parsers import expat

from neutronclient.common import constants
from neutronclient.common import exceptions as exception
from neutronclient.openstack.common.gettextutils import _
from neutronclient.openstack.common import jsonutils
from tackerclient.common import constants
from tackerclient.common import exceptions as exception
from tackerclient.openstack.common.gettextutils import _
from tackerclient.openstack.common import jsonutils

LOG = logging.getLogger(__name__)

Expand Down Expand Up @@ -76,7 +76,7 @@ def __init__(self, metadata=None, xmlns=None):
if not xmlns:
xmlns = self.metadata.get('xmlns')
if not xmlns:
xmlns = constants.XML_NS_V20
xmlns = constants.XML_NS_V10
self.xmlns = xmlns

def default(self, data):
Expand Down Expand Up @@ -242,7 +242,7 @@ def __init__(self, metadata=None):
self.metadata = metadata or {}
xmlns = self.metadata.get('xmlns')
if not xmlns:
xmlns = constants.XML_NS_V20
xmlns = constants.XML_NS_V10
self.xmlns = xmlns

def _get_key(self, tag):
Expand Down Expand Up @@ -359,7 +359,7 @@ def __call__(self, datastring):
return self.default(datastring)


# NOTE(maru): this class is duplicated from neutron.wsgi
# NOTE(maru): this class is duplicated from tacker.wsgi
class Serializer(object):
"""Serializes and deserializes dictionaries to certain MIME types."""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import os
import sys

from neutronclient.common import _
from neutronclient.common import exceptions
from neutronclient.openstack.common import strutils
from tackerclient.common import _
from tackerclient.common import exceptions
from tackerclient.openstack.common import strutils


def env(*vars, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

import netaddr

from neutronclient.common import exceptions
from neutronclient.openstack.common.gettextutils import _
from tackerclient.common import exceptions
from tackerclient.openstack.common.gettextutils import _


def validate_int_range(parsed_args, attr_name, min_value=None, max_value=None):
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
Usual usage in an openstack.common module:
from neutronclient.openstack.common.gettextutils import _
from tackerclient.openstack.common.gettextutils import _
"""

import copy
Expand All @@ -32,8 +32,8 @@
from babel import localedata
import six

_localedir = os.environ.get('neutronclient'.upper() + '_LOCALEDIR')
_t = gettext.translation('neutronclient', localedir=_localedir, fallback=True)
_localedir = os.environ.get('tackerclient'.upper() + '_LOCALEDIR')
_t = gettext.translation('tackerclient', localedir=_localedir, fallback=True)

_AVAILABLE_LANGUAGES = {}
USE_LAZY = False
Expand All @@ -53,7 +53,7 @@ def enable_lazy():

def _(msg):
if USE_LAZY:
return Message(msg, 'neutronclient')
return Message(msg, 'tackerclient')
else:
return _t.ugettext(msg)

Expand Down
Loading

0 comments on commit 14eeda8

Please sign in to comment.