Merge "Fixed multiple py34 gate issues"
This commit is contained in:
commit
dcbc564263
@ -13,6 +13,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
import weakref
|
import weakref
|
||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
@ -136,19 +137,22 @@ class NeutronManager(object):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def load_class_for_provider(namespace, plugin_provider):
|
def load_class_for_provider(namespace, plugin_provider):
|
||||||
if not plugin_provider:
|
if not plugin_provider:
|
||||||
LOG.exception(_LE("Error, plugin is not set"))
|
LOG.error(_LE("Error, plugin is not set"))
|
||||||
raise ImportError(_("Plugin not found."))
|
raise ImportError(_("Plugin not found."))
|
||||||
try:
|
try:
|
||||||
# Try to resolve plugin by name
|
# Try to resolve plugin by name
|
||||||
mgr = driver.DriverManager(namespace, plugin_provider)
|
mgr = driver.DriverManager(namespace, plugin_provider)
|
||||||
plugin_class = mgr.driver
|
plugin_class = mgr.driver
|
||||||
except RuntimeError as e1:
|
except RuntimeError:
|
||||||
|
e1_info = sys.exc_info()
|
||||||
# fallback to class name
|
# fallback to class name
|
||||||
try:
|
try:
|
||||||
plugin_class = importutils.import_class(plugin_provider)
|
plugin_class = importutils.import_class(plugin_provider)
|
||||||
except ImportError as e2:
|
except ImportError:
|
||||||
LOG.exception(_LE("Error loading plugin by name, %s"), e1)
|
LOG.error(_LE("Error loading plugin by name"),
|
||||||
LOG.exception(_LE("Error loading plugin by class, %s"), e2)
|
exc_info=e1_info)
|
||||||
|
LOG.error(_LE("Error loading plugin by class"),
|
||||||
|
exc_info=True)
|
||||||
raise ImportError(_("Plugin not found."))
|
raise ImportError(_("Plugin not found."))
|
||||||
return plugin_class
|
return plugin_class
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ class OwnerCheck(policy.Check):
|
|||||||
# If we are here split failed with both separators
|
# If we are here split failed with both separators
|
||||||
err_reason = (_("Unable to find resource name in %s") %
|
err_reason = (_("Unable to find resource name in %s") %
|
||||||
self.target_field)
|
self.target_field)
|
||||||
LOG.exception(err_reason)
|
LOG.error(err_reason)
|
||||||
raise exceptions.PolicyCheckError(
|
raise exceptions.PolicyCheckError(
|
||||||
policy="%s:%s" % (self.kind, self.match),
|
policy="%s:%s" % (self.kind, self.match),
|
||||||
reason=err_reason)
|
reason=err_reason)
|
||||||
@ -236,7 +236,7 @@ class OwnerCheck(policy.Check):
|
|||||||
err_reason = (_("Unable to verify match:%(match)s as the "
|
err_reason = (_("Unable to verify match:%(match)s as the "
|
||||||
"parent resource: %(res)s was not found") %
|
"parent resource: %(res)s was not found") %
|
||||||
{'match': self.match, 'res': parent_res})
|
{'match': self.match, 'res': parent_res})
|
||||||
LOG.exception(err_reason)
|
LOG.error(err_reason)
|
||||||
raise exceptions.PolicyCheckError(
|
raise exceptions.PolicyCheckError(
|
||||||
policy="%s:%s" % (self.kind, self.match),
|
policy="%s:%s" % (self.kind, self.match),
|
||||||
reason=err_reason)
|
reason=err_reason)
|
||||||
|
@ -197,7 +197,7 @@ class ProviderConfiguration(object):
|
|||||||
if v['driver'] == driver:
|
if v['driver'] == driver:
|
||||||
msg = (_("Driver %s is not unique across providers") %
|
msg = (_("Driver %s is not unique across providers") %
|
||||||
driver)
|
driver)
|
||||||
LOG.exception(msg)
|
LOG.error(msg)
|
||||||
raise n_exc.Invalid(msg)
|
raise n_exc.Invalid(msg)
|
||||||
|
|
||||||
def _ensure_default_unique(self, type, default):
|
def _ensure_default_unique(self, type, default):
|
||||||
@ -207,7 +207,7 @@ class ProviderConfiguration(object):
|
|||||||
if k[0] == type and v['default']:
|
if k[0] == type and v['default']:
|
||||||
msg = _("Multiple default providers "
|
msg = _("Multiple default providers "
|
||||||
"for service %s") % type
|
"for service %s") % type
|
||||||
LOG.exception(msg)
|
LOG.error(msg)
|
||||||
raise n_exc.Invalid(msg)
|
raise n_exc.Invalid(msg)
|
||||||
|
|
||||||
def add_provider(self, provider):
|
def add_provider(self, provider):
|
||||||
|
@ -341,7 +341,7 @@ class TestCli(base.BaseTestCase):
|
|||||||
mock.patch.object(cli, '_use_separate_migration_branches',
|
mock.patch.object(cli, '_use_separate_migration_branches',
|
||||||
return_value=not branchless):
|
return_value=not branchless):
|
||||||
fc.return_value.get_heads.return_value = heads
|
fc.return_value.get_heads.return_value = heads
|
||||||
with mock.patch('six.moves.builtins.open') as mock_open:
|
with mock.patch.object(cli, 'open') as mock_open:
|
||||||
mock_open.return_value.__enter__ = lambda s: s
|
mock_open.return_value.__enter__ = lambda s: s
|
||||||
mock_open.return_value.__exit__ = mock.Mock()
|
mock_open.return_value.__exit__ = mock.Mock()
|
||||||
mock_open.return_value.read.return_value = (
|
mock_open.return_value.read.return_value = (
|
||||||
|
Loading…
Reference in New Issue
Block a user