Format string and error log correction
Change-Id: I54829ae69d7f44b6aa46c3c2aabecfb380103fee
This commit is contained in:
parent
987cc8c770
commit
30ccde094b
@ -1,6 +1,6 @@
|
||||
from orm.common.orm_common.injector import injector
|
||||
from orm.common.orm_common.utils import api_error_utils as err_utils
|
||||
from orm.common.orm_common.utils.error_base import ErrorStatus, NotAllowedError, NotFoundError
|
||||
from orm.common.orm_common.utils.error_base import ErrorStatus, NotAllowedError, NotFoundError, InputValueError
|
||||
from orm.common.orm_common.utils import utils as common_utils
|
||||
from orm.services.flavor_manager.fms_rest.controllers.v1.orm.flavors.os_extra_specs import OsExtraSpecsController
|
||||
from orm.services.flavor_manager.fms_rest.controllers.v1.orm.flavors.regions import RegionController
|
||||
@ -55,28 +55,28 @@ class FlavorController(rest.RestController):
|
||||
return result
|
||||
|
||||
except (ErrorStatus, NotFoundError) as exception:
|
||||
LOG.error("FlavorController - Failed to CreateFlavor", exception)
|
||||
LOG.error("FlavorController - Failed to CreateFlavor: " + str(exception))
|
||||
raise err_utils.get_error(request.transaction_id,
|
||||
message=str(exception),
|
||||
status_code=exception.status_code)
|
||||
|
||||
except (InputValueError, ValueError) as exception:
|
||||
LOG.error("FlavorController - Failed to CreateFlavor", exception)
|
||||
LOG.error("FlavorController - Failed to CreateFlavor: " + str(exception))
|
||||
raise err_utils.get_error(request.transaction_id,
|
||||
status_code=400,
|
||||
error_details=str(exception))
|
||||
message=str(exception))
|
||||
|
||||
except Exception as exception:
|
||||
LOG.error("FlavorController - Failed to CreateFlavor", exception)
|
||||
LOG.error("FlavorController - Failed to CreateFlavor: " + str(exception))
|
||||
raise err_utils.get_error(request.transaction_id,
|
||||
status_code=500,
|
||||
error_details=str(exception))
|
||||
message=str(exception))
|
||||
|
||||
@wsexpose(FlavorWrapper, str, body=FlavorWrapper, rest_content_types='json')
|
||||
def put(self, flavor_id, flavors):
|
||||
# update flavor is not featured
|
||||
raise err_utils.get_error(request.transaction_id,
|
||||
status_code=405)
|
||||
status_code=403)
|
||||
|
||||
@wsexpose(FlavorWrapper, str, rest_content_types='json')
|
||||
def get(self, flavor_uuid_or_name):
|
||||
@ -90,16 +90,16 @@ class FlavorController(rest.RestController):
|
||||
return result
|
||||
|
||||
except (ErrorStatus, NotFoundError) as exception:
|
||||
LOG.error("FlavorController - Failed to GetFlavorDetails", exception)
|
||||
LOG.error("FlavorController - Failed to GetFlavorDetails: " + str(exception))
|
||||
raise err_utils.get_error(request.transaction_id,
|
||||
message=str(exception),
|
||||
status_code=exception.status_code)
|
||||
|
||||
except Exception as exception:
|
||||
LOG.error("FlavorController - Failed to GetFlavorDetails", exception)
|
||||
LOG.error("FlavorController - Failed to GetFlavorDetails: " + str(exception))
|
||||
raise err_utils.get_error(request.transaction_id,
|
||||
status_code=500,
|
||||
error_details=str(exception))
|
||||
message=str(exception))
|
||||
|
||||
@wsexpose(FlavorListFullResponse, str, str, str, str, str, str, str,
|
||||
str, str, rest_content_types='json')
|
||||
@ -117,16 +117,16 @@ class FlavorController(rest.RestController):
|
||||
starts_with, contains, alias)
|
||||
return result
|
||||
except ErrorStatus as exception:
|
||||
LOG.error("FlavorController - Failed to GetFlavorlist", exception)
|
||||
LOG.error("FlavorController - Failed to GetFlavorlist: " + str(exception))
|
||||
raise err_utils.get_error(request.transaction_id,
|
||||
message=str(exception),
|
||||
status_code=exception.status_code)
|
||||
|
||||
except Exception as exception:
|
||||
LOG.error("FlavorController - Failed to GetFlavorlist", exception)
|
||||
LOG.error("FlavorController - Failed to GetFlavorlist: " + str(exception))
|
||||
raise err_utils.get_error(request.transaction_id,
|
||||
status_code=500,
|
||||
error_details=str(exception))
|
||||
message=str(exception))
|
||||
|
||||
@wsexpose(None, str, rest_content_types='json', status_code=204)
|
||||
def delete(self, flavor_uuid=None):
|
||||
@ -144,13 +144,13 @@ class FlavorController(rest.RestController):
|
||||
event_details=event_details)
|
||||
|
||||
except (ErrorStatus, NotAllowedError, NotFoundError) as exception:
|
||||
LOG.error("FlavorController - Failed to delete flavor", exception)
|
||||
LOG.error("FlavorController - Failed to delete flavor: " + str(exception))
|
||||
raise err_utils.get_error(request.transaction_id,
|
||||
message=str(exception),
|
||||
status_code=exception.status_code)
|
||||
|
||||
except Exception as exception:
|
||||
LOG.error("FlavorController - Failed to delete flavor", exception)
|
||||
LOG.error("FlavorController - Failed to delete flavor: " + str(exception))
|
||||
raise err_utils.get_error(request.transaction_id,
|
||||
status_code=500,
|
||||
error_details=str(exception))
|
||||
message=str(exception))
|
||||
|
@ -308,8 +308,8 @@ class Flavor(Model):
|
||||
vram_limit,
|
||||
vram_limit // 1024))
|
||||
if int(self.vcpus) not in list(range(1, vcpu_limit + 1)):
|
||||
raise InputValueError("vcpus value % is out of range. Expected"
|
||||
" range is 1-%" % (str(self.vcpus), str(vcpu_limit)))
|
||||
raise InputValueError("vcpus value {} is out of range. Expected"
|
||||
" range is 1-{}".format(self.vcpus, vcpu_limit))
|
||||
if int(self.disk) < 0:
|
||||
raise InputValueError("disk cannot be less than zero")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user