def getKit(self, session: Session, name, version, iteration: Optional[str] = None): """ Get kit from the db. Returns: kit Throws: KitNotFound DbError """ try: dbKit = self._kitsDbHandler.getKit(session, name, version, iteration) kit = Kit.getFromDbDict(dbKit.__dict__) return self.__retrieveAllKitData(dbKit, kit) except TortugaException: raise except Exception as ex: self.getLogger().exception('%s' % ex) raise
def getKitById(self, session: Session, id_): """ Get kit from the db Returns: kit Throws: KitNotFound DbError """ try: dbKit = self._kitsDbHandler.getKitById(session, id_) kit = Kit.getFromDbDict(dbKit.__dict__) return self.__retrieveAllKitData(dbKit, kit) except TortugaException: raise except Exception as ex: self._logger.exception(str(ex)) raise
def getKitList(self, session: Session, os_kits_only: Optional[bool] = False): """ Get list of all available or os kits only from the db """ try: kits = [] for kit in self._kitsDbHandler.getKitList( session, os_kits_only=os_kits_only): self.loadRelations(kit, {'components': True}) kits.append(Kit.getFromDbDict(kit.__dict__)) return TortugaObjectList(kits) except TortugaException: raise except Exception as ex: self._logger.exception(str(ex)) raise
def getKitList(self): """ Get list of all available kits from the db. """ session = DbManager().openSession() try: kits = [] for kit in self._kitsDbHandler.getKitList(session): self.loadRelations(kit, {'components': True}) kits.append(Kit.getFromDbDict(kit.__dict__)) return TortugaObjectList(kits) except TortugaException: raise except Exception as ex: self.getLogger().exception('%s' % (ex)) raise finally: DbManager().closeSession()
def getKitById(self, id_): """ Get kit from the db Returns: kit Throws: KitNotFound DbError """ session = DbManager().openSession() try: dbKit = self._kitsDbHandler.getKitById(session, id_) kit = Kit.getFromDbDict(dbKit.__dict__) return self.__retrieveAllKitData(dbKit, kit) except TortugaException as ex: raise except Exception as ex: self.getLogger().exception('%s' % ex) raise finally: DbManager().closeSession()