From ac1170a0f1c18414b841399a94e344fe1cad9073 Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 21 Apr 2020 00:03:13 +0530 Subject: [PATCH 1/3] Remove wrong IL country code in vat_rates --- vat_rates.csv | 1 - 1 file changed, 1 deletion(-) diff --git a/vat_rates.csv b/vat_rates.csv index 17bdb997..72870530 100644 --- a/vat_rates.csv +++ b/vat_rates.csv @@ -321,5 +321,4 @@ IM",GBP,0.1,standard, 2019-12-17,,IS,EUR,0.24,standard,Iceland standard VAT (added manually) 2019-12-17,,FX,EUR,0.20,standard,France metropolitan standard VAT (added manually) 2020-01-04,,CY,EUR,0.19,standard,Cyprus standard VAT (added manually) -2019-01-04,,IL,EUR,0.23,standard,Ireland standard VAT (added manually) 2019-01-04,,LI,EUR,0.077,standard,Liechtenstein standard VAT (added manually) From c1473fa37401e931e5a4b31946157addc520af2f Mon Sep 17 00:00:00 2001 From: PCoder Date: Mon, 25 May 2020 11:10:41 +0530 Subject: [PATCH 2/3] Handle updated templates --- dynamicweb/settings/base.py | 5 +++++ opennebula_api/models.py | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index 743d11c3..76135165 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -763,6 +763,11 @@ PRE_EU_VAT_RATE = float(env('PRE_EU_VAT_RATE')) 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: from .local import * # flake8: noqa else: diff --git a/opennebula_api/models.py b/opennebula_api/models.py index 19e3e4f7..6d9716b4 100644 --- a/opennebula_api/models.py +++ b/opennebula_api/models.py @@ -427,8 +427,12 @@ class OpenNebulaManager(): template_id = int(template_id) try: 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) - except: + except Exception as ex: + logger.debug("Template Id we are looking for : %s" % template_id) + logger.error(str(ex)) raise ConnectionRefusedError def create_template(self, name, cores, memory, disk_size, core_price, From 17a8efb0b6eecacd5ccd5e00336ced5c69aea12d Mon Sep 17 00:00:00 2001 From: PCoder Date: Mon, 25 May 2020 11:33:58 +0530 Subject: [PATCH 3/3] Fix variable name --- opennebula_api/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opennebula_api/models.py b/opennebula_api/models.py index 6d9716b4..92d5c568 100644 --- a/opennebula_api/models.py +++ b/opennebula_api/models.py @@ -427,8 +427,8 @@ class OpenNebulaManager(): template_id = int(template_id) try: template_pool = self._get_template_pool() - if template_id in settings.UPDATED_TEMPLATES.keys(): - template_id = settings.UPDATED_TEMPLATES[template_id] + if template_id in settings.UPDATED_TEMPLATES_DICT.keys(): + template_id = settings.UPDATED_TEMPLATES_DICT[template_id] return template_pool.get_by_id(template_id) except Exception as ex: logger.debug("Template Id we are looking for : %s" % template_id)