From d27ea66dfb0ecd332a464000d6379f3427ba8a2b Mon Sep 17 00:00:00 2001 From: micafer Date: Thu, 21 Sep 2023 15:53:43 +0200 Subject: [PATCH] Minor updates --- changelog | 5 ++++- scripts/db_1_14_X_to_1_15_X.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/changelog b/changelog index 5cbfb397..a440652d 100644 --- a/changelog +++ b/changelog @@ -743,5 +743,8 @@ IM 1.15.0: * Enable to set root disk size in EC2, Azure and GCE conns. * Return error if instance is not get in stop, start, reboot ops in EC2 conn * Fix error in OSCAR or Lambda cons with env variables with ":" - * Improve performance in Infrastructure List operation + * Improve performance in Infrastructure List operation. + WARNING: It requires a DB update. + Please make a copy of the DB before applying the script. + Use scripts/db_1_14_X_to_1_15_X.py to update it. * Add requests-cache to improve performance in TOSCA parsing \ No newline at end of file diff --git a/scripts/db_1_14_X_to_1_15_X.py b/scripts/db_1_14_X_to_1_15_X.py index 72ee3794..2282d8c6 100644 --- a/scripts/db_1_14_X_to_1_15_X.py +++ b/scripts/db_1_14_X_to_1_15_X.py @@ -38,7 +38,7 @@ def get_data_from_db(db, inf_id): if len(res) > 0: elem = res[0] if db.db_type == DataBase.MONGO: - data = elem[data] + data = elem["data"] else: data = elem[0] try: @@ -82,7 +82,7 @@ def get_data_from_db(db, inf_id): res = db.update("inf_list", {"id": inf_id}, {"auth": auth}) else: res = db.execute("UPDATE `inf_list` SET `auth` = %s WHERE id = %s", (auth, inf_id)) - except Exception as e: + except Exception: sys.stderr.write("Error updating auth field in Inf ID: %s. Ignoring.\n" % inf_id) else: sys.stdout.write("There are no inf_list table. Do not need to update.")