本文整理汇总了Python中neutron_lib.exceptions.NotFound方法的典型用法代码示例。如果您正苦于以下问题:Python exceptions.NotFound方法的具体用法?Python exceptions.NotFound怎么用?Python exceptions.NotFound使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neutron_lib.exceptions
的用法示例。
在下文中一共展示了exceptions.NotFound方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _test_recovery_creates_operation
# 需要导入模块: from neutron_lib import exceptions [as 别名]
# 或者: from neutron_lib.exceptions import NotFound [as 别名]
def _test_recovery_creates_operation(
self, operation, resource, odl_resource, expected_operation,
recovery_mock):
if resource is not None:
recovery_mock.return_value = resource
else:
recovery_mock.side_effect = nexc.NotFound
original_row = self._test_recovery(
operation, odl_resource, odl_const.COMPLETED)
pending_row = db.get_all_db_rows_by_state(
self.db_context, odl_const.PENDING)[0]
self.assertEqual(expected_operation, pending_row['operation'])
self.assertEqual(original_row['object_type'],
pending_row['object_type'])
self.assertEqual(original_row['object_uuid'],
pending_row['object_uuid'])
示例2: _sync_resource_to_odl
# 需要导入模块: from neutron_lib import exceptions [as 别名]
# 或者: from neutron_lib.exceptions import NotFound [as 别名]
def _sync_resource_to_odl(context, row, operation_type, exists_on_odl):
resource = None
try:
resource = _get_latest_resource(context, row)
except nexc.NotFound:
if exists_on_odl:
journal.record(context, row.object_type,
row.object_uuid, odl_const.ODL_DELETE, [])
else:
journal.record(context, row.object_type, row.object_uuid,
operation_type, resource)
journal.entry_complete(context, row)
示例3: test__get_latest_resource_none
# 需要导入模块: from neutron_lib import exceptions [as 别名]
# 或者: from neutron_lib.exceptions import NotFound [as 别名]
def test__get_latest_resource_none(self, plugin_mock):
plugin_mock.return_value.get_network.side_effect = nexc.NotFound()
l2 = mech_driver_v2.OpenDaylightMechanismDriver.RESOURCES
full_sync.ALL_RESOURCES[plugin_constants.CORE] = l2
mock_row = self._mock_row(odl_const.ODL_NETWORK)
self.assertRaises(
nexc.NotFound, recovery._get_latest_resource,
self.db_context.session, mock_row)
示例4: test_recovery_created_resource_missing_and_not_in_odl
# 需要导入模块: from neutron_lib import exceptions [as 别名]
# 或者: from neutron_lib.exceptions import NotFound [as 别名]
def test_recovery_created_resource_missing_and_not_in_odl(self, rmock):
rmock.side_effect = nexc.NotFound
self._test_recovery(odl_const.ODL_CREATE, None, odl_const.COMPLETED)
示例5: test_recovery_created_resource_missing_and_not_in_odl_purged
# 需要导入模块: from neutron_lib import exceptions [as 别名]
# 或者: from neutron_lib.exceptions import NotFound [as 别名]
def test_recovery_created_resource_missing_and_not_in_odl_purged(
self, rmock):
rmock.side_effect = nexc.NotFound
self._disable_retention()
self._test_recovery(odl_const.ODL_CREATE, None, None)
示例6: test_recovery_updated_resource_missing_and_not_in_odl_purged
# 需要导入模块: from neutron_lib import exceptions [as 别名]
# 或者: from neutron_lib.exceptions import NotFound [as 别名]
def test_recovery_updated_resource_missing_and_not_in_odl_purged(
self, rmock):
rmock.side_effect = nexc.NotFound
self._disable_retention()
self._test_recovery(odl_const.ODL_UPDATE, None, None)
示例7: test_not_found
# 需要导入模块: from neutron_lib import exceptions [as 别名]
# 或者: from neutron_lib.exceptions import NotFound [as 别名]
def test_not_found(self):
self._check_nexc(
ne.NotFound,
_('An unknown exception occurred.'))