From 20c38082c60f606992d3bdd921b5d7a70a993ec2 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Wed, 2 Nov 2011 13:47:05 +0100 Subject: [PATCH] save pb_modules in persistence db --- kernel_inpbuilder.py | 3 +++ kernel_persistence.py | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/kernel_inpbuilder.py b/kernel_inpbuilder.py index 63d858e..02c672a 100644 --- a/kernel_inpbuilder.py +++ b/kernel_inpbuilder.py @@ -15,6 +15,7 @@ from glob import glob from logging import Formatter from ftplib import FTP from multiprocessing import cpu_count +import kernel_persistence __version__ = '0.0.2' @@ -327,6 +328,8 @@ def install_extra_modules(): logger.info( 'module-assistant unpacked successfully.' ) + kernel_revision_obj = kernel_persistence.get_last_kernel_revision_obj(GIT_BRANCH_NAME) + kernel_persistence.update_kernel_f_obj(kernel_revision_obj, ' '.join(extra_modules)) return True diff --git a/kernel_persistence.py b/kernel_persistence.py index 9855604..973909e 100644 --- a/kernel_persistence.py +++ b/kernel_persistence.py @@ -92,3 +92,18 @@ def update_kernel_revision_obj(kernel_version_obj, new_revision): return True finally: session.close() + +def update_kernel_modules_obj(kernel_version_obj, pb_modules): + session = Session() + kernel_version_obj.pb_modules = pb_modules + session.add(kernel_version_obj) + try: + session.commit() + except Exception, error: + logger.error('Some error happend while commiting pb_modules') + logger.exception(error) + return False + else: + return True + finally: + session.close() -- 2.39.5