- Better error reporting.
- Flask now uses application's logger instead of its own. - ucloud file scanner refactored.
This commit is contained in:
parent
eea6c1568e
commit
972bb5a920
14 changed files with 157 additions and 154 deletions
|
|
@ -44,29 +44,7 @@ def capture_all_exception(func):
|
|||
try:
|
||||
func(*args, **kwargs)
|
||||
except Exception:
|
||||
logger.info("Exception absorbed by captual_all_exception()")
|
||||
logger.exception(func.__name__)
|
||||
|
||||
return wrapper
|
||||
|
||||
|
||||
def need_running_vm(func):
|
||||
@wraps(func)
|
||||
def wrapper(self, e):
|
||||
vm = self.get_vm(self.running_vms, e.key)
|
||||
if vm:
|
||||
try:
|
||||
status = vm.handle.command("query-status")
|
||||
logger.debug("VM Status Check - %s", status)
|
||||
except Exception as exception:
|
||||
logger.info("%s failed - VM %s %s", func.__name__, e, exception)
|
||||
else:
|
||||
return func(e)
|
||||
|
||||
return None
|
||||
else:
|
||||
logger.info("%s failed because VM %s is not running", func.__name__, e.key)
|
||||
return None
|
||||
logger.exception('Unhandled exception occur in %s. For more details see Syslog.', __name__)
|
||||
|
||||
return wrapper
|
||||
|
||||
|
|
@ -168,7 +146,6 @@ class VMM:
|
|||
self.create(vm_entry)
|
||||
self.launch_vm(vm_entry)
|
||||
|
||||
@need_running_vm
|
||||
@capture_all_exception
|
||||
def stop(self, vm_entry):
|
||||
vm = self.get_vm(self.running_vms, vm_entry.key)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue