diff --git a/IM/InfrastructureInfo.py b/IM/InfrastructureInfo.py index 9e26b9c5..805cd8d8 100644 --- a/IM/InfrastructureInfo.py +++ b/IM/InfrastructureInfo.py @@ -184,16 +184,14 @@ def deserialize(str_data): return newinf @staticmethod - def deserialize_auth(str_data): + def deserialize_auth(inf_id, deleted, str_data): """ Only Loads auth data """ newinf = InfrastructureInfo() - dic = json.loads(str_data) - newinf.deleted = dic['deleted'] - newinf.id = dic['id'] - if dic['auth']: - newinf.auth = Authentication.deserialize(dic['auth']) + newinf.deleted = deleted + newinf.id = inf_id + newinf.auth = Authentication.deserialize(str_data) return newinf def destroy_vms(self, auth): diff --git a/IM/InfrastructureList.py b/IM/InfrastructureList.py index f02a56b6..eff8673b 100644 --- a/IM/InfrastructureList.py +++ b/IM/InfrastructureList.py @@ -188,7 +188,8 @@ def _get_data_from_db(db_url, inf_id=None, auth=None): if db.db_type == DataBase.MONGO: res = db.find("inf_list", {"deleted": 0}, {data_field: True, "deleted": True}, [('_id', -1)]) else: - res = db.select("select " + data_field + ",deleted from inf_list where deleted = 0 order by rowid desc") + res = db.select("select " + data_field + ",deleted from inf_list where deleted = 0" + " order by rowid desc") if len(res) > 0: for elem in res: if db.db_type == DataBase.MONGO: @@ -285,8 +286,8 @@ def _get_inf_ids_from_db(auth=None, get_all=False): if db.connect(): inf_list = [] if db.db_type == DataBase.MONGO: - filter = InfrastructureList._gen_filter_from_auth(auth, get_all) - res = db.find("inf_list", filter, {"id": True}, [('id', -1)]) + filt = InfrastructureList._gen_filter_from_auth(auth, get_all) + res = db.find("inf_list", filt, {"id": True}, [('id', -1)]) else: where = InfrastructureList._gen_where_from_auth(auth, get_all) res = db.select("select id from inf_list %s order by rowid desc" % where)