from oslo_log import log as logging
import oslo_messaging as messaging
from oslo_utils import strutils
+import six
import webob
from webob import exc
except KeyError:
raise exc.HTTPBadRequest(explanation=_("Must specify 'host'"))
force_host_copy = params.get('force_host_copy', False)
- if isinstance(force_host_copy, basestring):
+ if isinstance(force_host_copy, six.string_types):
try:
force_host_copy = strutils.bool_from_string(force_host_copy,
strict=True)
raise webob.exc.HTTPBadRequest(explanation=msg)
force = params.get('force', False)
- if isinstance(force, basestring):
+ if isinstance(force, six.string_types):
try:
force = strutils.bool_from_string(force, strict=False)
except ValueError:
msg = _("Must specify readonly in request.")
raise webob.exc.HTTPBadRequest(explanation=msg)
- if isinstance(readonly_flag, basestring):
+ if isinstance(readonly_flag, six.string_types):
try:
readonly_flag = strutils.bool_from_string(readonly_flag,
strict=True)
msg = _("Must specify bootable in request.")
raise webob.exc.HTTPBadRequest(explanation=msg)
- if isinstance(bootable, basestring):
+ if isinstance(bootable, six.string_types):
try:
bootable = strutils.bool_from_string(bootable,
strict=True)
def __getitem__(self, idx):
"""Retrieve a child node by index or name."""
- if isinstance(idx, basestring):
+ if isinstance(idx, six.string_types):
# Allow access by node name
return self._childmap[idx]
else:
from oslo_context import context
from oslo_log import log as logging
from oslo_utils import timeutils
+import six
from cinder.i18n import _
from cinder import policy
self.remote_address = remote_address
if not timestamp:
timestamp = timeutils.utcnow()
- elif isinstance(timestamp, basestring):
+ elif isinstance(timestamp, six.string_types):
timestamp = timeutils.parse_isotime(timestamp)
self.timestamp = timestamp
self.quota_class = quota_class
# now be either form below:
# Host
# Host#Pool
- if host and isinstance(host, basestring):
+ if host and isinstance(host, six.string_types):
session = get_session()
with session.begin():
host_attr = getattr(models.Volume, 'host')
# NOTE(bcwaldon): used to store non-string data in glance metadata
def _json_loads(properties, attr):
prop = properties[attr]
- if isinstance(prop, basestring):
+ if isinstance(prop, six.string_types):
properties[attr] = jsonutils.loads(prop)
def _json_dumps(properties, attr):
prop = properties[attr]
- if not isinstance(prop, basestring):
+ if not isinstance(prop, six.string_types):
properties[attr] = jsonutils.dumps(prop)
from oslo_log import log as logging
from oslo_utils import importutils
from oslo_utils import timeutils
+import six
from cinder import context
from cinder import db
if not quota_driver_class:
quota_driver_class = CONF.quota_driver
- if isinstance(quota_driver_class, basestring):
+ if isinstance(quota_driver_class, six.string_types):
quota_driver_class = importutils.import_object(quota_driver_class)
self._resources = {}
from eventlet import greenthread
from oslo_concurrency import processutils
from oslo_log import log as logging
+import six
from cinder import utils
LOG.debug('Faked command matched %s' % fake_replier[0])
break
- if isinstance(reply_handler, basestring):
+ if isinstance(reply_handler, six.string_types):
# If the reply handler is a string, return it as stdout
reply = reply_handler, ''
else:
from oslo_concurrency import processutils
from oslo_log import log as logging
+import six
from cinder import exception
from cinder.i18n import _, _LE
vs = []
for k in keys:
v = a.get(k, None)
- if isinstance(v, basestring) or v is None:
+ if isinstance(v, six.string_types) or v is None:
v = [v]
if isinstance(v, list):
vs.append(v)
else:
yield []
- if isinstance(self.raw, basestring):
+ if isinstance(self.raw, six.string_types):
stdout, stderr = self.raw, ''
else:
stdout, stderr = self.raw
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import importutils
+import six
from cinder import exception
from cinder.i18n import _, _LE, _LW, _LI
start = time.time()
done = False
- if isinstance(success_msgs, basestring):
+ if isinstance(success_msgs, six.string_types):
success_msgs = [success_msgs]
while not done:
request_needed = True
verify_needed = True
- if isinstance(request_success_msgs, basestring):
+ if isinstance(request_success_msgs, six.string_types):
request_success_msgs = [request_success_msgs]
rargs = rargs if rargs else []