Merge branch 'master' into feature/monthly-invoices

This commit is contained in:
PCoder 2019-04-13 12:13:38 +02:00
commit 3bf4f4dca7
5 changed files with 30 additions and 6 deletions

View file

@ -1,3 +1,6 @@
2.5: 2019-04-11
* #6589: [vm creation, listing] Fix obtaining ip address/template related info from oca api call (MR!690, MR!691 and MR!692)
[python-oca] VirtualMachinePool infoextended (https://github.com/ungleich/python-oca/pull/3)
2.4.10: 2019-02-14 2.4.10: 2019-02-14
* #6451: [dg, gdpr banner] Update phone number (MR!688 by pcoder) * #6451: [dg, gdpr banner] Update phone number (MR!688 by pcoder)
2.4.9: 2019-02-01 2.4.9: 2019-02-01

View file

@ -245,6 +245,8 @@ def create_vm_task(self, vm_template_id, user, specs, template, order_id):
} }
email = EmailMessage(**email_data) email = EmailMessage(**email_data)
email.send() email.send()
else:
logger.debug("VM's ipv6 is None. Hence not created VMDetail")
except Exception as e: except Exception as e:
logger.error(str(e)) logger.error(str(e))
try: try:

View file

@ -686,18 +686,26 @@ if ENABLE_LOGGING:
custom_handler_item = { custom_handler_item = {
'custom_file': { 'custom_file': {
'level': LOG_LEVEL, 'level': LOG_LEVEL,
'class': 'logging.FileHandler', 'class': 'logging.handlers.RotatingFileHandler',
'filename': 'filename':
"{PROJECT_DIR}/{LEVEL}.log".format( "{PROJECT_DIR}/logs/{LEVEL}.log".format(
LEVEL=LOG_LEVEL.lower(), LEVEL=LOG_LEVEL.lower(),
PROJECT_DIR=PROJECT_DIR PROJECT_DIR=PROJECT_DIR
) ),
'maxBytes': 1024 * 1024 * 5,
'backupCount': 10,
'formatter': 'standard',
} }
} }
handlers_dict.update(custom_handler_item) handlers_dict.update(custom_handler_item)
LOGGING = { LOGGING = {
'version': 1, 'version': 1,
'disable_existing_loggers': False, 'disable_existing_loggers': False,
'formatters': {
'standard': {
'format': '%(asctime)s %(levelname)s %(name)s: %(message)s'
}
},
'handlers': handlers_dict, 'handlers': handlers_dict,
'loggers': loggers_dict 'loggers': loggers_dict
} }

0
logs/.gitkeep Normal file
View file

View file

@ -168,10 +168,21 @@ class OpenNebulaManager():
raise raise
return user_pool return user_pool
def _get_vm_pool(self): def _get_vm_pool(self, vm_id=None, infoextended=True):
"""
vm_id: int - the id of the VM that needs to looked up in the vm pool;
when set to None, looks for everything in the infoextended
"""
try: try:
vm_pool = oca.VirtualMachinePool(self.client) vm_pool = oca.VirtualMachinePool(self.client)
vm_pool.info() if infoextended:
vm_pool.infoextended(
filter_key_value_str='ID={vm_id}'.format(vm_id=vm_id) if
vm_id is not None else '',
vm_state=-1 # Look for VMs in any state, except DONE
)
else:
vm_pool.info()
return vm_pool return vm_pool
except AttributeError: except AttributeError:
logger.error('Could not connect via client, using oneadmin instead') logger.error('Could not connect via client, using oneadmin instead')
@ -202,7 +213,7 @@ class OpenNebulaManager():
def get_vm(self, vm_id): def get_vm(self, vm_id):
vm_id = int(vm_id) vm_id = int(vm_id)
try: try:
vm_pool = self._get_vm_pool() vm_pool = self._get_vm_pool(vm_id)
return vm_pool.get_by_id(vm_id) return vm_pool.get_by_id(vm_id)
except WrongIdError: except WrongIdError:
raise WrongIdError raise WrongIdError