Refactored code to use new olso namespace

Change-Id: Ia591851b89022dcb158a026bc5093be0e2951415
This commit is contained in:
Stéphane Albert 2015-07-30 18:00:16 +02:00
parent a37e6ec6c1
commit 980dbac279
12 changed files with 27 additions and 21 deletions

View File

@ -15,7 +15,7 @@ from keystoneclient.auth.identity import v3 as v3_auth
from keystoneclient import discover
from keystoneclient import exceptions as ks_exc
from keystoneclient import session
from oslo.utils import strutils
from oslo_utils import strutils
import six.moves.urllib.parse as urlparse
from cloudkittyclient.common import utils

View File

@ -20,9 +20,9 @@ import sys
import textwrap
import uuid
from oslo.serialization import jsonutils
from oslo.utils import encodeutils
from oslo.utils import importutils
from oslo_serialization import jsonutils
from oslo_utils import encodeutils
from oslo_utils import importutils
import prettytable
import six

View File

@ -17,14 +17,14 @@ See http://docs.openstack.org/developer/oslo.i18n/usage.html
"""
try:
import oslo.i18n
import oslo_i18n
# NOTE(dhellmann): This reference to o-s-l-o will be replaced by the
# application name when this module is synced into the separate
# repository. It is OK to have more than one translation function
# using the same domain, since there will still only be one message
# catalog.
_translators = oslo.i18n.TranslatorFactory(domain='cloudkittyclient')
_translators = oslo_i18n.TranslatorFactory(domain='cloudkittyclient')
# The primary translation function using the well-known name "_"
_ = _translators.primary

View File

@ -40,7 +40,7 @@ Base utilities to build API operation managers and objects on top of.
import abc
import copy
from oslo.utils import strutils
from oslo_utils import strutils
import six
from six.moves.urllib import parse
@ -402,7 +402,7 @@ class CrudManager(BaseManager):
'name': self.resource_class.__name__,
'args': kwargs
}
raise exceptions.NotFound(404, msg)
raise exceptions.NotFound(msg)
elif num > 1:
raise exceptions.NoUniqueMatch
else:
@ -509,8 +509,9 @@ class Resource(object):
new = self.manager.get(self.id)
if new:
self._add_details(new._info)
self._add_details(
{'x_request_id': self.manager.client.last_request_id})
if self.manager.client.last_request_id:
self._add_details(
{'x_request_id': self.manager.client.last_request_id})
def __eq__(self, other):
if not isinstance(other, Resource):

View File

@ -34,8 +34,8 @@ try:
except ImportError:
import json
from oslo.utils import encodeutils
from oslo.utils import importutils
from oslo_utils import encodeutils
from oslo_utils import importutils
import requests
from cloudkittyclient.openstack.common._i18n import _
@ -123,6 +123,9 @@ class HTTPClient(object):
"'%s'" % url,
]
if not kwargs.get('verify', self.verify):
string_parts.insert(1, '--insecure')
for element in kwargs['headers']:
header = ("-H '%s: %s'" %
self._safe_header(element, kwargs['headers'][element]))

View File

@ -465,7 +465,7 @@ def from_response(response, method, url):
kwargs["details"] = (error.get("details") or
six.text_type(body))
elif content_type.startswith("text/"):
kwargs["details"] = response.text
kwargs["details"] = getattr(response, 'text', '')
try:
cls = _code_map[response.status_code]

View File

@ -181,8 +181,7 @@ class FakeHTTPClient(client.HTTPClient):
else:
status, body = resp
headers = {}
self.last_request_id = headers.get('x-openstack-request-id',
'req-test')
self.last_request_id = headers.get('x-openstack-request-id')
return TestResponse({
"status_code": status,
"text": body,

View File

@ -24,8 +24,8 @@
#
########################################################################
from oslo.utils import encodeutils
from oslo.utils import uuidutils
from oslo_utils import encodeutils
from oslo_utils import uuidutils
import six
from cloudkittyclient.openstack.common._i18n import _

View File

@ -24,8 +24,8 @@ import os
import sys
import textwrap
from oslo.utils import encodeutils
from oslo.utils import strutils
from oslo_utils import encodeutils
from oslo_utils import strutils
import prettytable
import six
from six import moves

View File

@ -22,7 +22,7 @@ import argparse
import logging
import sys
from oslo.utils import encodeutils
from oslo_utils import encodeutils
import six
from stevedore import extension

View File

@ -15,7 +15,7 @@
import functools
from oslo.utils import strutils
from oslo_utils import strutils
from cloudkittyclient.common import utils
from cloudkittyclient import exc

View File

@ -6,3 +6,6 @@ pbr>=0.6,!=0.7,<1.0
Babel>=1.3
python-keystoneclient
stevedore
oslo.i18n
oslo.serialization
oslo.utils