Port from python2: Remove circular dependency on delete resource

python2: https://review.opendev.org/#/c/693399

Change-Id: I0f68235685f03fc73fb848997d5eba5e8915b477
This commit is contained in:
Chi Lo 2019-11-13 16:30:04 -08:00
parent bf8b33b372
commit 6f3fb47049
14 changed files with 193 additions and 179 deletions

View File

@ -42,12 +42,12 @@ class RegionController(rest.RestController):
raise err_utils.get_error(request.transaction_id,
status_code=409,
message='Region already exists',
error_details=exception.message)
error_details=str(exception))
except ErrorStatus as exception:
LOG.log_exception("CustomerController - Failed to update regions", exception)
raise err_utils.get_error(request.transaction_id,
message=exception.message,
message=str(exception),
status_code=exception.status_code)
except Exception as exception:
@ -77,7 +77,7 @@ class RegionController(rest.RestController):
except ErrorStatus as exception:
LOG.log_exception("CustomerController - Failed to Replace regions", exception)
raise err_utils.get_error(request.transaction_id,
message=exception.message,
message=str(exception),
status_code=exception.status_code)
except Exception as exception:
@ -95,14 +95,11 @@ class RegionController(rest.RestController):
force_delete = True
else:
force_delete = False
requester = request.headers.get('X-RANGER-Requester')
is_rds_client_request = requester == 'rds_resource_service_proxy'
LOG.info("Delete Region (delete) customer id {0} region_id: {1} by RDS Proxy: {2} ".format(customer_id, region_id, is_rds_client_request))
authentication.authorize(request, 'customers:delete_region')
try:
customer_logic = CustomerLogic()
customer_logic.delete_region(customer_id, region_id, request.transaction_id,
is_rds_client_request, force_delete)
force_delete)
LOG.info("RegionController - Delete Region (delete) finished well")
event_details = 'Customer {} region: {} deleted'.format(
@ -118,7 +115,7 @@ class RegionController(rest.RestController):
except ErrorStatus as exception:
LOG.log_exception("CustomerController - Failed to delete region", exception)
raise err_utils.get_error(request.transaction_id,
message=exception.message,
message=str(exception),
status_code=exception.status_code)
except Exception as exception:

View File

@ -54,13 +54,13 @@ class RegionController(rest.RestController):
raise err_utils.get_error(request.transaction_id,
status_code=409,
message='Region already exists',
error_details=exception.message)
error_details=str(exception))
except ErrorStatus as exception:
LOG.log_exception(
"RegionController - Failed to add regions", exception)
raise err_utils.get_error(request.transaction_id,
message=exception.message,
message=str(exception),
status_code=exception.status_code)
except Exception as exception:
LOG.log_exception(
@ -79,17 +79,12 @@ class RegionController(rest.RestController):
else:
force_delete = False
requester = request.headers.get('X-RANGER-Requester')
is_rds_client_request = requester == 'rds_resource_service_proxy'
LOG.info("Delete Region group id {0} region_id: {1} by RDS Proxy: "
" {2} ".format(group_id, region_id, is_rds_client_request))
authentication.authorize(request, 'groups:delete_region')
try:
group_logic = GroupLogic()
group_logic.delete_region(group_id,
region_id,
request.transaction_id,
is_rds_client_request,
force_delete)
LOG.info("RegionController - Delete Region finished")
@ -109,7 +104,7 @@ class RegionController(rest.RestController):
LOG.log_exception("RegionController - Failed to delete region",
exception)
raise err_utils.get_error(request.transaction_id,
message=exception.message,
message=str(exception),
status_code=exception.status_code)
except Exception as exception:
LOG.log_exception("RegionController - Failed in delete Region",

View File

@ -588,15 +588,12 @@ class CustomerLogic(object):
datamanager.rollback()
raise exp
def delete_region(self, customer_id, region_id, transaction_id, on_success_by_rds,
force_delete):
def delete_region(self, customer_id, region_id, transaction_id, force_delete):
datamanager = DataManager()
try:
customer_region = datamanager.get_record('customer_region')
sql_customer = datamanager.get_customer_by_uuid(customer_id)
if on_success_by_rds and sql_customer is None:
return
if sql_customer is None:
raise ErrorStatus(404,
"customer with id {} does not exist".format(
@ -606,27 +603,22 @@ class CustomerLogic(object):
customer_region.delete_region_for_customer(customer_id, region_id)
datamanager.flush() # Get any exception created by this insert
if on_success_by_rds:
datamanager.commit()
LOG.debug("Region {0} in customer {1} deleted".format(region_id,
customer_id))
else:
region = next((r.region for r in sql_customer.customer_customer_regions if r.region.name == region_id), None)
if region:
if region.type == 'group':
set_utils_conf(conf)
regions = get_regions_of_group(region.name)
else:
regions = [region_id]
for region in customer_dict['regions']:
if region['name'] in regions:
region['action'] = 'delete'
RdsProxy.send_customer_dict(customer_dict, transaction_id, "PUT")
if force_delete:
datamanager.commit()
region = next((r.region for r in sql_customer.customer_customer_regions if r.region.name == region_id), None)
if region:
if region.type == 'group':
set_utils_conf(conf)
regions = get_regions_of_group(region.name)
else:
datamanager.rollback()
regions = [region_id]
for region in customer_dict['regions']:
if region['name'] in regions:
region['action'] = 'delete'
RdsProxy.send_customer_dict(customer_dict, transaction_id, "PUT")
if force_delete:
datamanager.commit()
else:
datamanager.rollback()
except Exception as exp:
datamanager.rollback()

View File

@ -57,7 +57,8 @@ class GroupLogic(object):
# add group default users
self.add_default_user_db(datamanager, group.users, [], sql_group.uuid)
# add default user(s) to all regions where group is assigned to
self.add_default_users_to_regions_db(datamanager, sql_group, group.users)
self.add_default_users_to_regions_db(
datamanager, sql_group, group.users)
self.add_roles_to_db(group.roles, sql_group.uuid, datamanager)
@ -669,14 +670,11 @@ class GroupLogic(object):
finally:
datamanager.close()
def delete_region(self, group_id, region_id, transaction_id,
on_success_by_rds, force_delete):
def delete_region(self, group_id, region_id, transaction_id, force_delete):
datamanager = DataManager()
try:
group_region = datamanager.get_record('groups_region')
sql_group = datamanager.get_group_by_uuid_or_name(group_id)
if on_success_by_rds and sql_group is None:
return
if sql_group is None:
raise ErrorStatus(
404,
@ -686,28 +684,23 @@ class GroupLogic(object):
group_region.delete_region_for_group(group_id, region_id)
datamanager.flush()
if on_success_by_rds:
datamanager.commit()
LOG.debug("Region {0} in group {1} deleted".format(region_id,
group_id))
else:
region = next((r.region for r in sql_group.group_regions
if r.region.name == region_id), None)
if region:
if region.type == 'group':
set_utils_conf(conf)
regions = get_regions_of_group(region.name)
else:
regions = [region_id]
for region in group_dict['regions']:
if region['name'] in regions:
region['action'] = 'delete'
RdsProxy.send_group_dict(group_dict, transaction_id, "PUT")
if force_delete:
datamanager.commit()
region = next((r.region for r in sql_group.group_regions
if r.region.name == region_id), None)
if region:
if region.type == 'group':
set_utils_conf(conf)
regions = get_regions_of_group(region.name)
else:
datamanager.rollback()
regions = [region_id]
for region in group_dict['regions']:
if region['name'] in regions:
region['action'] = 'delete'
RdsProxy.send_group_dict(group_dict, transaction_id, "PUT")
if force_delete:
datamanager.commit()
else:
datamanager.rollback()
except Exception as exp:
datamanager.rollback()

View File

@ -16,7 +16,8 @@ di = injector.get_di()
@di.dependsOn('flavor_logic')
@di.dependsOn('utils')
class RegionController(rest.RestController):
@wsexpose(RegionWrapper, str, body=RegionWrapper, rest_content_types='json', status_code=201)
@wsexpose(RegionWrapper, str, body=RegionWrapper,
rest_content_types='json', status_code=201)
def post(self, flavor_id, region_wrapper):
flavor_logic, utils = di.resolver.unpack(RegionController)
@ -24,7 +25,8 @@ class RegionController(rest.RestController):
authentication.authorize(request, 'flavor:add_flavor_regions')
try:
result = flavor_logic.add_regions(flavor_id, region_wrapper, request.transaction_id)
result = flavor_logic.add_regions(
flavor_id, region_wrapper, request.transaction_id)
LOG.info("RegionController - regions added: " + str(result))
@ -36,13 +38,15 @@ class RegionController(rest.RestController):
return result
except ErrorStatus as exception:
LOG.log_exception("RegionController - Failed to add region", exception)
LOG.log_exception("RegionController - Failed to add region",
exception)
raise err_utils.get_error(request.transaction_id,
message=exception.message,
message=str(exception),
status_code=exception.status_code)
except Exception as exception:
LOG.log_exception("RegionController - Failed to add region", exception)
LOG.log_exception("RegionController - Failed to add region",
exception)
raise err_utils.get_error(request.transaction_id,
status_code=500,
error_details=str(exception))
@ -54,32 +58,30 @@ class RegionController(rest.RestController):
else:
force_delete = False
flavor_logic, utils = di.resolver.unpack(RegionController)
requester = request.headers.get('X-RANGER-Requester')
is_rds_client_request = requester == 'rds_resource_service_proxy'
LOG.info("RegionController - Delete region:{0} by RDS Proxy: {1} ".format(region_name, is_rds_client_request))
authentication.authorize(request, 'flavor:delete_flavor_region')
try:
result = flavor_logic.delete_region(flavor_id, region_name, request.transaction_id,
is_rds_client_request, force_delete)
result = flavor_logic.delete_region(
flavor_id, region_name, request.transaction_id, force_delete)
if is_rds_client_request:
LOG.info("RegionController - region deleted: " + str(result))
LOG.info("RegionController - region deleted: " + str(result))
event_details = 'Flavor {} region {} deleted'.format(flavor_id,
region_name)
utils.audit_trail('delete region', request.transaction_id,
request.headers, flavor_id,
event_details=event_details)
event_details = 'Flavor {} region {} deleted'.format(flavor_id,
region_name)
utils.audit_trail('delete region', request.transaction_id,
request.headers, flavor_id,
event_details=event_details)
except ErrorStatus as exception:
LOG.log_exception("RegionController - Failed to delete region", exception)
LOG.log_exception("RegionController - Failed to delete region",
exception)
raise err_utils.get_error(request.transaction_id,
message=exception.message,
message=str(exception),
status_code=exception.status_code)
except Exception as exception:
LOG.log_exception("RegionController - Failed to delete region", exception)
LOG.log_exception("RegionController - Failed to delete region",
exception)
raise err_utils.get_error(request.transaction_id,
status_code=500,
error_details=str(exception))

View File

@ -256,16 +256,13 @@ def add_regions(flavor_uuid, regions, transaction_id):
@di.dependsOn('data_manager')
def delete_region(flavor_uuid, region_name, transaction_id, on_success_by_rds,
force_delete):
def delete_region(flavor_uuid, region_name, transaction_id, force_delete):
DataManager = di.resolver.unpack(delete_region)
datamanager = DataManager()
try:
flavor_rec = datamanager.get_record('flavor')
sql_flavor = flavor_rec.get_flavor_by_id(flavor_uuid)
if not sql_flavor and on_success_by_rds:
return
if not sql_flavor:
raise ErrorStatus(404,
'flavor id {0} not found'.format(flavor_uuid))
@ -275,15 +272,12 @@ def delete_region(flavor_uuid, region_name, transaction_id, on_success_by_rds,
# get any exception created by previous actions against the database
datamanager.flush()
if on_success_by_rds:
send_to_rds_if_needed(sql_flavor, existing_region_names, "put",
transaction_id)
if force_delete:
datamanager.commit()
else:
send_to_rds_if_needed(sql_flavor, existing_region_names, "put",
transaction_id)
if force_delete:
datamanager.commit()
else:
datamanager.rollback()
datamanager.rollback()
except ErrorStatus as exp:
LOG.log_exception("FlavorLogic - Failed to update flavor", str(exp))

View File

@ -99,19 +99,16 @@ class RegionController(rest.RestController):
image_logic, utils = di.resolver.unpack(RegionController)
auth.authorize(request, "region:delete")
try:
requester = request.headers.get('X-RANGER-Requester')
is_rds_client_request = requester == 'rds_resource_service_proxy'
LOG.info("RegionController - Delete region:{0} by RDS Proxy: {1} ".format(region_name, is_rds_client_request))
result = image_logic.delete_region(image_id, region_name, request.transaction_id, is_rds_client_request,
force_delete)
if is_rds_client_request:
LOG.info("RegionController - region deleted: " + str(result))
result = image_logic.delete_region(
image_id, region_name, request.transaction_id, force_delete)
event_details = 'Image {} region {} deleted'.format(image_id,
region_name)
utils.audit_trail('delete region', request.transaction_id,
request.headers, image_id,
event_details=event_details)
LOG.info("RegionController - region deleted: " + str(result))
event_details = 'Image {} region {} deleted'.format(image_id,
region_name)
utils.audit_trail('delete region', request.transaction_id,
request.headers, image_id,
event_details=event_details)
except ErrorStatus as exception: # include NotFoundError
LOG.log_exception("RegionController - Failed to delete region", exception)

View File

@ -261,16 +261,13 @@ def replace_regions(image_uuid, regions, transaction_id):
@di.dependsOn('data_manager')
def delete_region(image_uuid, region_name, transaction_id, on_success_by_rds,
force_delete):
def delete_region(image_uuid, region_name, transaction_id, force_delete):
DataManager = di.resolver.unpack(delete_region)
datamanager = DataManager()
try:
image_rec = datamanager.get_record('image')
sql_image = image_rec.get_image_by_id(image_uuid)
if on_success_by_rds and not sql_image:
return
if not sql_image:
raise ErrorStatus(404, 'image with id: {0} not found'.format(
image_uuid))
@ -283,17 +280,15 @@ def delete_region(image_uuid, region_name, transaction_id, on_success_by_rds,
existing_region_names = sql_image.get_existing_region_names()
sql_image.remove_region(region_name)
datamanager.flush() # Get any exception created by
# previous actions against the database
if on_success_by_rds:
# Get any exception created by previous actions against the database
datamanager.flush()
send_to_rds_if_needed(sql_image, existing_region_names, "put",
transaction_id)
if force_delete:
datamanager.commit()
else:
send_to_rds_if_needed(sql_image, existing_region_names, "put",
transaction_id)
if force_delete:
datamanager.commit()
else:
datamanager.rollback()
datamanager.rollback()
except ErrorStatus as exp:
LOG.log_exception("ImageLogic - Failed to update image", exp)

View File

@ -14,7 +14,8 @@ server = {
# DB configurations
database = {
'url': config.db_connect
'url': config.db_connect,
'connection_string': config.db_connect
}
sot = {

View File

@ -3,6 +3,12 @@ import logging
from pecan import conf
import requests
from orm.services.customer_manager.cms_rest.data.data_manager \
import DataManager as CmsDataManager
from orm.services.flavor_manager.fms_rest.data.sql_alchemy.data_manager \
import DataManager as FmsDataManager
from orm.services.image_manager.ims.persistency.sql_alchemy.data_manager \
import DataManager as ImsDataManager
from orm.services.resource_distributor.rds.services.base import ErrorMessage
from orm.services.resource_distributor.rds.utils import \
authentication as AuthService
@ -10,7 +16,6 @@ from orm.services.resource_distributor.rds.utils import \
logger = logging.getLogger(__name__)
headers = {'content-type': 'application/json'}
@ -22,61 +27,106 @@ def _set_headers(region):
headers['X-Auth-Region'] = region
except Exception:
logger.error("no token")
headers['X-RANGER-Requester'] = 'rds_resource_service_proxy'
def invoke_resources_region_delete(resource_type, region, resource_id):
logger.debug("REGION STATUS PROXY - send delete status to {} service for "
"region {}".format(resource_type, region))
logger.debug("REGION STATUS PROXY - delete {} resource with ID:{} for "
"region {}".format(resource_type, resource_id, region))
_set_headers(region)
try:
if resource_type == "customer":
logger.debug("sending the data to {} server delete "
"method ".format(resource_type))
response = requests.delete(
conf.cms.base_url + (conf.cms.delete_region).format(
resource_id, region),
headers=headers, verify=conf.verify)
delete_customer_region(resource_id, region)
elif resource_type == "group":
logger.debug("sending the data to {} server delete "
"method ".format(resource_type))
response = requests.delete(
conf.cms.base_url + (conf.cms.delete_groups_region).format(
resource_id, region),
headers=headers, verify=conf.verify)
delete_group_region(resource_id, region)
elif resource_type == "flavor":
logger.debug("sending the data to {} server delete "
"method ".format(resource_type))
response = requests.delete(
conf.fms.base_url + (conf.fms.delete_region).format(
resource_id, region),
headers=headers, verify=conf.verify)
delete_flavor_region(resource_id, region)
elif resource_type == "image":
logger.debug("sending the data to {} server delete "
"method ".format(resource_type))
response = requests.delete(
conf.ims.base_url + (conf.ims.delete_region).format(
resource_id, region),
headers=headers, verify=conf.verify)
else:
response = None
delete_image_region(resource_id, region)
logger.debug("got response {} from send delete status to {} service.".
format(response, resource_type))
except requests.ConnectionError as exp:
except Exception as exp:
logger.error(exp)
logger.exception(exp)
raise ErrorMessage("fail to connect to server {}".format(exp.message))
if response.status_code != 200:
raise ErrorMessage(
"Got error from rds server, code: {0} message: {1}".format(
response.status_code, response.content))
"Fail to delete {} resource {}".format(resource_type, str(exp)))
return
def delete_customer_region(customer_id, region_id):
datamanager = CmsDataManager()
try:
customer_region = datamanager.get_record('customer_region')
customer_region.delete_region_for_customer(customer_id, region_id)
datamanager.flush()
datamanager.commit()
except Exception as exp:
logger.error("RDS CMS resource - Failed to delete region")
logger.exception(exp)
datamanager.rollback()
raise exp
finally:
datamanager.close()
def delete_group_region(group_uuid, region_name):
datamanager = CmsDataManager()
try:
group_region = datamanager.get_record('groups_region')
group_region.delete_region_for_group(group_uuid, region_name)
datamanager.flush()
datamanager.commit()
except Exception as exp:
logger.error("RDS Group resource - Failed to delete region")
logger.exception(exp)
datamanager.rollback()
raise exp
finally:
datamanager.close()
def delete_flavor_region(flavor_uuid, region_name):
datamanager = FmsDataManager()
try:
flavor_rec = datamanager.get_record('flavor')
sql_flavor = flavor_rec.get_flavor_by_id(flavor_uuid)
if sql_flavor is None:
return
sql_flavor.remove_region(region_name)
datamanager.flush()
datamanager.commit()
except Exception as exp:
logger.error("RDS FMS resource - Failed to delete region")
logger.exception(exp)
datamanager.rollback()
raise exp
finally:
datamanager.close()
def delete_image_region(image_uuid, region_name):
datamanager = ImsDataManager()
try:
image_rec = datamanager.get_record('image')
sql_image = image_rec.get_image_by_id(image_uuid)
if sql_image is None:
return
sql_image.remove_region(region_name)
datamanager.flush()
datamanager.commit()
except Exception as exp:
logger.error("RDS IMS resource - Failed to delete region")
logger.exception(exp)
datamanager.rollback()
raise exp
finally:
datamanager.close()
def send_image_metadata(meta_data, region, resource_id, action='post'):
logger.debug(
"IMS PROXY - send metadata to ims {} for region {}".format(meta_data,

View File

@ -356,14 +356,14 @@ class TestCustomerLogic(FunctionalTest):
def test_delete_regions_success(self):
logic = customer_logic.CustomerLogic()
logic.delete_region('customer_id', 'region_id', 'transaction_is', True, False)
logic.delete_region('customer_id', 'region_id', 'transaction_is', False)
assert record_mock.delete_region_for_customer.called
assert data_manager_mock.commit.called
assert data_manager_mock.rollback.called
def test_delete_regions_success_force_delete(self):
logic = customer_logic.CustomerLogic()
logic.delete_region('customer_id', 'region_id', 'transaction_is', True, True)
logic.delete_region('customer_id', 'region_id', 'transaction_is', True)
assert record_mock.delete_region_for_customer.called
assert data_manager_mock.commit.called
@ -375,7 +375,7 @@ class TestCustomerLogic(FunctionalTest):
logic = customer_logic.CustomerLogic()
self.assertRaises(SystemError, logic.delete_region, 'customer_id',
'region_id', 'transaction_is', True, False)
'region_id', 'transaction_is', False)
assert data_manager_mock.rollback.called
def test_get_customer_list_by_criteria(self):

View File

@ -82,16 +82,14 @@ class TestGroupLogic(FunctionalTest):
def test_delete_region_success(self):
logic = group_logic.GroupLogic()
logic.delete_region('group_id', 'region_id', 'transaction_is', True,
False)
logic.delete_region('group_id', 'region_id', 'transaction_is', False)
assert record_mock.delete_region_for_group.called
assert data_manager_mock.commit.called
assert data_manager_mock.rollback.called
def test_delete_region_success_force_delete(self):
logic = group_logic.GroupLogic()
logic.delete_region('group_id', 'region_id', 'transaction_is', True,
True)
logic.delete_region('group_id', 'region_id', 'transaction_is', True)
assert record_mock.delete_region_for_group.called
assert data_manager_mock.commit.called
@ -103,7 +101,7 @@ class TestGroupLogic(FunctionalTest):
logic = group_logic.GroupLogic()
self.assertRaises(SystemError, logic.delete_region, 'group_id',
'region_id', 'transaction_is', True, False)
'region_id', 'transaction_is', False)
assert data_manager_mock.rollback.called
def test_get_group_list_by_criteria(self):

View File

@ -464,7 +464,7 @@ class TestFlavorLogic(FunctionalTest):
('rds_proxy', get_rds_proxy_mock()))
res_regions = flavor_logic.delete_region('uuid', RegionWrapper(
[Region(name='test_region')]), 'transaction', True, False)
[Region(name='test_region')]), 'transaction', False)
@patch.object(flavor_logic, 'send_to_rds_if_needed')
@patch.object(flavor_logic, 'get_flavor_by_uuid')
@ -478,13 +478,13 @@ class TestFlavorLogic(FunctionalTest):
injector.override_injected_dependency(
('data_manager', get_datamanager_mock))
self.assertRaises(flavor_logic.ErrorStatus, flavor_logic.delete_region,
'uuid', 'test_region', 'transaction', False, False)
'uuid', 'test_region', 'transaction', False)
error = 2
injector.override_injected_dependency(
('data_manager', get_datamanager_mock))
self.assertRaises(SystemError, flavor_logic.delete_region,
'uuid', 'test_region', 'transaction', False, False)
'uuid', 'test_region', 'transaction', False)
@patch.object(flavor_logic, 'send_to_rds_if_needed')
@patch.object(flavor_logic, 'get_flavor_by_uuid')

View File

@ -484,7 +484,7 @@ class TestDeleteRegion(FunctionalTest):
rds_proxy, mock_data_manager = get_data_manager_mock()
mock_di.resolver.unpack.return_value = mock_data_manager
result = image_logic.delete_region('uuid', mock.MagicMock(),
'transaction', True, False)
'transaction', False)
@mock.patch.object(image_logic, 'send_to_rds_if_needed', return_value=True)
@mock.patch.object(image_logic, 'di')
@ -492,7 +492,7 @@ class TestDeleteRegion(FunctionalTest):
rds_proxy, mock_data_manager = get_data_manager_mock()
mock_di.resolver.unpack.return_value = mock_data_manager
result = image_logic.delete_region('uuid', mock.MagicMock(),
'transaction', False, True)
'transaction', True)
@mock.patch.object(image_logic, 'send_to_rds_if_needed', return_value=True)
@mock.patch.object(image_logic, 'di')
@ -502,7 +502,7 @@ class TestDeleteRegion(FunctionalTest):
mock_sql_image=None)
mock_di.resolver.unpack.return_value = mock_data_manager
self.assertRaises(image_logic.ErrorStatus, image_logic.delete_region,
'uuid', mock.MagicMock(), 'transaction', False, False)
'uuid', mock.MagicMock(), 'transaction', False)
@mock.patch.object(image_logic, 'send_to_rds_if_needed', return_value=True)
@mock.patch.object(image_logic, 'di')
@ -511,7 +511,7 @@ class TestDeleteRegion(FunctionalTest):
rds_proxy, mock_data_manager = get_data_manager_mock(protected=True)
mock_di.resolver.unpack.return_value = mock_data_manager
self.assertRaises(image_logic.ErrorStatus, image_logic.delete_region,
'uuid', mock.MagicMock(), 'transaction', False, False)
'uuid', mock.MagicMock(), 'transaction', False)
@mock.patch.object(image_logic, 'get_image_by_uuid',
side_effect=ValueError('test'))
@ -524,7 +524,7 @@ class TestDeleteRegion(FunctionalTest):
rds_proxy, mock_data_manager = get_data_manager_mock()
mock_di.resolver.unpack.return_value = mock_data_manager
self.assertRaises(ValueError, image_logic.delete_region,
'uuid', mock.MagicMock(), 'transaction', False, False)
'uuid', mock.MagicMock(), 'transaction', False)
class TestAddCustomers(FunctionalTest):