Remove copy of incubated Oslo code

The Oslo team has moved all previously incubated code from the
openstack/oslo-incubator repository into separate library repositories
and released those libraries to the Python Package Index. Many of our
big tent project teams are still using the old, unsupported, incubated
versions of the code. The Oslo team has been working to remove that
incubated code from projects, and the time has come to finish that work.

As one of community-wide goals in Ocata, please see:
https://github.com/openstack/governance/blob/master/goals/ocata/remove-incubated-oslo-code.rst

Note: This commit also fix pep8 violations.

Change-Id: Ic2d8079b85ebd302a27785772462378f13d593d0
This commit is contained in:
ChangBo Guo(gcb)
2016-09-28 11:31:14 +08:00
committed by ChangBo Guo(gcb)
parent d2d3a475e2
commit ce263ecc9e
17 changed files with 32 additions and 66 deletions

View File

@@ -24,7 +24,7 @@ import os
import six import six
from stevedore import extension from stevedore import extension
from karborclient.openstack.common.apiclient import exceptions from karborclient.common.apiclient import exceptions
_discovered_plugins = {} _discovered_plugins = {}
@@ -41,7 +41,7 @@ def discover_auth_systems():
def add_plugin(ext): def add_plugin(ext):
_discovered_plugins[ext.name] = ext.plugin _discovered_plugins[ext.name] = ext.plugin
ep_namespace = "karborclient.openstack.common.apiclient.auth" ep_namespace = "karborclient.common.apiclient.auth"
mgr = extension.ExtensionManager(ep_namespace) mgr = extension.ExtensionManager(ep_namespace)
mgr.map(add_plugin) mgr.map(add_plugin)
@@ -143,8 +143,7 @@ class BaseAuthPlugin(object):
@classmethod @classmethod
def add_opts(cls, parser): def add_opts(cls, parser):
"""Populate the parser with the options for this plugin. """Populate the parser with the options for this plugin."""
"""
for opt in cls.opt_names: for opt in cls.opt_names:
# use `BaseAuthPlugin.common_opt_names` since it is never # use `BaseAuthPlugin.common_opt_names` since it is never
# changed in child classes # changed in child classes
@@ -153,8 +152,7 @@ class BaseAuthPlugin(object):
@classmethod @classmethod
def add_common_opts(cls, parser): def add_common_opts(cls, parser):
"""Add options that are common for several plugins. """Add options that are common for several plugins."""
"""
for opt in cls.common_opt_names: for opt in cls.common_opt_names:
cls._parser_add_opt(parser, opt) cls._parser_add_opt(parser, opt)
@@ -191,8 +189,7 @@ class BaseAuthPlugin(object):
@abc.abstractmethod @abc.abstractmethod
def _do_authenticate(self, http_client): def _do_authenticate(self, http_client):
"""Protected method for authentication. """Protected method for authentication."""
"""
def sufficient_options(self): def sufficient_options(self):
"""Check if all required options are present. """Check if all required options are present.

View File

@@ -31,8 +31,8 @@ from oslo_utils import uuidutils
import six import six
from six.moves.urllib import parse from six.moves.urllib import parse
from karborclient.common.apiclient import exceptions
from karborclient.i18n import _ from karborclient.i18n import _
from karborclient.openstack.common.apiclient import exceptions
def getid(obj): def getid(obj):
@@ -462,8 +462,7 @@ class Resource(object):
@property @property
def human_id(self): def human_id(self):
"""Human-readable ID which can be used for bash completion. """Human-readable ID which can be used for bash completion."""
"""
if self.HUMAN_ID: if self.HUMAN_ID:
name = getattr(self, self.NAME_ATTR, None) name = getattr(self, self.NAME_ATTR, None)
if name is not None: if name is not None:
@@ -481,7 +480,7 @@ class Resource(object):
def __getattr__(self, k): def __getattr__(self, k):
if k not in self.__dict__: if k not in self.__dict__:
#NOTE(bcwaldon): disallow lazy-loading if already loaded once # NOTE(bcwaldon): disallow lazy-loading if already loaded once
if not self.is_loaded(): if not self.is_loaded():
self.get() self.get()
return self.__getattr__(k) return self.__getattr__(k)

View File

@@ -40,7 +40,6 @@ from karborclient.i18n import _
from karborclient.openstack.common.apiclient import exceptions from karborclient.openstack.common.apiclient import exceptions
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
@@ -63,7 +62,7 @@ class HTTPClient(object):
into terminal and send the same request with curl. into terminal and send the same request with curl.
""" """
user_agent = "karborclient.openstack.common.apiclient" user_agent = "karborclient.common.apiclient"
def __init__(self, def __init__(self,
auth_plugin, auth_plugin,
@@ -272,7 +271,7 @@ class HTTPClient(object):
>>> def test_clients(): >>> def test_clients():
... from keystoneclient.auth import keystone ... from keystoneclient.auth import keystone
... from openstack.common.apiclient import client ... from karborclient.common.apiclient import client
... auth = keystone.KeystoneAuthPlugin( ... auth = keystone.KeystoneAuthPlugin(
... username="user", password="pass", tenant_name="tenant", ... username="user", password="pass", tenant_name="tenant",
... auth_url="http://auth:5000/v2.0") ... auth_url="http://auth:5000/v2.0")
@@ -358,8 +357,7 @@ class BaseClient(object):
"Must be one of: %(version_map)s") % { "Must be one of: %(version_map)s") % {
'api_name': api_name, 'api_name': api_name,
'version': version, 'version': version,
'version_map': ', '.join(version_map.keys()) 'version_map': ', '.join(version_map.keys())}
}
raise exceptions.UnsupportedVersion(msg) raise exceptions.UnsupportedVersion(msg)
return importutils.import_class(client_path) return importutils.import_class(client_path)

View File

@@ -28,8 +28,7 @@ from karborclient.i18n import _
class ClientException(Exception): class ClientException(Exception):
"""The base exception class for all exceptions this library raises. """The base exception class for all exceptions this library raises."""
"""
pass pass
@@ -107,8 +106,7 @@ class AmbiguousEndpoints(EndpointException):
class HttpError(ClientException): class HttpError(ClientException):
"""The base exception class for all HTTP exceptions. """The base exception class for all HTTP exceptions."""
"""
http_status = 0 http_status = 0
message = _("HTTP Error") message = _("HTTP Error")
@@ -426,7 +424,7 @@ def from_response(response, method, url):
""" """
req_id = response.headers.get("x-openstack-request-id") req_id = response.headers.get("x-openstack-request-id")
#NOTE(hdd) true for older versions of nova and cinder # NOTE(hdd) true for older versions of nova and cinder
if not req_id: if not req_id:
req_id = response.headers.get("x-compute-request-id") req_id = response.headers.get("x-compute-request-id")
kwargs = { kwargs = {

View File

@@ -30,7 +30,7 @@ import requests
import six import six
from six.moves.urllib import parse from six.moves.urllib import parse
from karborclient.openstack.common.apiclient import client from karborclient.common.apiclient import client
def assert_has_keys(dct, required=None, optional=None): def assert_has_keys(dct, required=None, optional=None):
@@ -48,8 +48,7 @@ def assert_has_keys(dct, required=None, optional=None):
class TestResponse(requests.Response): class TestResponse(requests.Response):
"""Wrap requests.Response and provide a convenient initialization. """Wrap requests.Response and provide a convenient initialization."""
"""
def __init__(self, data): def __init__(self, data):
super(TestResponse, self).__init__() super(TestResponse, self).__init__()
@@ -86,13 +85,12 @@ class FakeHTTPClient(client.HTTPClient):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.callstack = [] self.callstack = []
self.fixtures = kwargs.pop("fixtures", None) or {} self.fixtures = kwargs.pop("fixtures", None) or {}
if not args and not "auth_plugin" in kwargs: if not args and "auth_plugin" not in kwargs:
args = (None, ) args = (None, )
super(FakeHTTPClient, self).__init__(*args, **kwargs) super(FakeHTTPClient, self).__init__(*args, **kwargs)
def assert_called(self, method, url, body=None, pos=-1): def assert_called(self, method, url, body=None, pos=-1):
"""Assert than an API method was just called. """Assert than an API method was just called."""
"""
expected = (method, url) expected = (method, url)
called = self.callstack[pos][0:2] called = self.callstack[pos][0:2]
assert self.callstack, \ assert self.callstack, \
@@ -107,8 +105,7 @@ class FakeHTTPClient(client.HTTPClient):
(self.callstack[pos][3], body)) (self.callstack[pos][3], body))
def assert_called_anytime(self, method, url, body=None): def assert_called_anytime(self, method, url, body=None):
"""Assert than an API method was called anytime in the test. """Assert than an API method was called anytime in the test."""
"""
expected = (method, url) expected = (method, url)
assert self.callstack, \ assert self.callstack, \

View File

@@ -20,8 +20,9 @@ import copy
import six import six
from six.moves.urllib import parse from six.moves.urllib import parse
from karborclient.common.apiclient import exceptions
from karborclient.common import http from karborclient.common import http
from karborclient.openstack.common.apiclient import exceptions
SORT_DIR_VALUES = ('asc', 'desc') SORT_DIR_VALUES = ('asc', 'desc')
SORT_KEY_VALUES = ('id', 'status', 'name', 'created_at') SORT_KEY_VALUES = ('id', 'status', 'name', 'created_at')

View File

@@ -26,7 +26,7 @@ import requests
import six import six
from six.moves import urllib from six.moves import urllib
from karborclient.openstack.common.apiclient import exceptions as exc from karborclient.common.apiclient import exceptions as exc
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
USER_AGENT = 'python-karborclient' USER_AGENT = 'python-karborclient'

View File

@@ -23,7 +23,7 @@ from oslo_utils import importutils
import prettytable import prettytable
from karborclient.openstack.common.apiclient import exceptions from karborclient.common.apiclient import exceptions
# Decorator for cli-args # Decorator for cli-args

View File

@@ -1,17 +0,0 @@
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import six
six.add_move(six.MovedModule('mox', 'mox', 'mox3.mox'))

View File

@@ -33,8 +33,9 @@ import six.moves.urllib.parse as urlparse
import karborclient import karborclient
from karborclient import client as karbor_client from karborclient import client as karbor_client
from karborclient.common.apiclient import exceptions as exc
from karborclient.common import utils from karborclient.common import utils
from karborclient.openstack.common.apiclient import exceptions as exc
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@@ -16,8 +16,8 @@ import socket
import mock import mock
import testtools import testtools
from karborclient.common.apiclient import exceptions as exc
from karborclient.common import http from karborclient.common import http
from karborclient.openstack.common.apiclient import exceptions as exc
from karborclient.tests.unit import fakes from karborclient.tests.unit import fakes

View File

@@ -23,7 +23,7 @@ from oslo_log import log
import six import six
from testtools import matchers from testtools import matchers
from karborclient.openstack.common.apiclient import exceptions from karborclient.common.apiclient import exceptions
import karborclient.shell import karborclient.shell
from karborclient.tests.unit import base from karborclient.tests.unit import base

View File

@@ -11,15 +11,15 @@
# under the License. # under the License.
import argparse import argparse
import os import os
from karborclient.common import base
from karborclient.common import utils
from karborclient.openstack.common.apiclient import exceptions
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
from oslo_utils import uuidutils from oslo_utils import uuidutils
from karborclient.common.apiclient import exceptions
from karborclient.common import base
from karborclient.common import utils
@utils.arg('--all-tenants', @utils.arg('--all-tenants',
dest='all_tenants', dest='all_tenants',

View File

@@ -1,8 +0,0 @@
[DEFAULT]
# The list of modules to copy from openstack-common
module=apiclient.exceptions
module=apiclient
# The base module to hold the copy of openstack.common
base=karborclient

View File

@@ -37,4 +37,4 @@ commands = oslo_debug_helper {posargs}
show-source = True show-source = True
ignore = E123,E125 ignore = E123,E125
builtins = _ builtins = _
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools