Handle updated templates
This commit is contained in:
		
					parent
					
						
							
								ac1170a0f1
							
						
					
				
			
			
				commit
				
					
						c1473fa374
					
				
			
		
					 2 changed files with 10 additions and 1 deletions
				
			
		|  | @ -763,6 +763,11 @@ PRE_EU_VAT_RATE = float(env('PRE_EU_VAT_RATE')) | ||||||
| 
 | 
 | ||||||
| VM_BASE_PRICE = float(env('VM_BASE_PRICE')) | VM_BASE_PRICE = float(env('VM_BASE_PRICE')) | ||||||
| 
 | 
 | ||||||
|  | UPDATED_TEMPLATES_STR = env('UPDATED_TEMPLATES') | ||||||
|  | UPDATED_TEMPLATES_DICT = {} | ||||||
|  | if UPDATED_TEMPLATES_STR: | ||||||
|  |     UPDATED_TEMPLATES_DICT = eval(UPDATED_TEMPLATES_STR) | ||||||
|  | 
 | ||||||
| if DEBUG: | if DEBUG: | ||||||
|     from .local import *  # flake8: noqa |     from .local import *  # flake8: noqa | ||||||
| else: | else: | ||||||
|  |  | ||||||
|  | @ -427,8 +427,12 @@ class OpenNebulaManager(): | ||||||
|         template_id = int(template_id) |         template_id = int(template_id) | ||||||
|         try: |         try: | ||||||
|             template_pool = self._get_template_pool() |             template_pool = self._get_template_pool() | ||||||
|  |             if template_id in settings.UPDATED_TEMPLATES.keys(): | ||||||
|  |                 template_id = settings.UPDATED_TEMPLATES[template_id] | ||||||
|             return template_pool.get_by_id(template_id) |             return template_pool.get_by_id(template_id) | ||||||
|         except: |         except Exception as ex: | ||||||
|  |             logger.debug("Template Id we are looking for : %s" % template_id) | ||||||
|  |             logger.error(str(ex)) | ||||||
|             raise ConnectionRefusedError |             raise ConnectionRefusedError | ||||||
| 
 | 
 | ||||||
|     def create_template(self, name, cores, memory, disk_size, core_price, |     def create_template(self, name, cores, memory, disk_size, core_price, | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue