Refactored Watcher codebase to add py34 support
Even though Watcher was mentioning python 3.4 as supported, it really wasn't the case as all the unit tests were not passing in this version of Python. This patchset fixes all the failing tests in Python 3.4 while keeping Watcher Python 2.7 compatible. DocImpact BugImpact Change-Id: Ie74acc08ef0a2899349a4b419728c89e416a18cb
This commit is contained in:
committed by
Jean-Emile DARTOIS
parent
b1fe7a5f3d
commit
d934971458
@@ -44,7 +44,7 @@ CONF.register_opts(exc_log_opts)
|
||||
|
||||
def _cleanse_dict(original):
|
||||
"""Strip all admin_password, new_pass, rescue_pass keys from a dict."""
|
||||
return dict((k, v) for k, v in original.iteritems() if "_pass" not in k)
|
||||
return dict((k, v) for k, v in six.iteritems(original) if "_pass" not in k)
|
||||
|
||||
|
||||
class WatcherException(Exception):
|
||||
@@ -77,7 +77,7 @@ class WatcherException(Exception):
|
||||
# kwargs doesn't match a variable in the message
|
||||
# log the issue and the kwargs
|
||||
LOG.exception(_LE('Exception in string format operation'))
|
||||
for name, value in kwargs.iteritems():
|
||||
for name, value in six.iteritems(kwargs):
|
||||
LOG.error("%s: %s" % (name, value))
|
||||
|
||||
if CONF.fatal_exception_format_errors:
|
||||
@@ -231,7 +231,7 @@ class PatchError(Invalid):
|
||||
class BaseException(Exception):
|
||||
|
||||
def __init__(self, desc=""):
|
||||
if (not isinstance(desc, basestring)):
|
||||
if (not isinstance(desc, six.string_types)):
|
||||
raise IllegalArgumentException(
|
||||
"Description must be an instance of str")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user