From: Holger Levsen Date: Wed, 2 Nov 2011 12:47:05 +0000 (+0100) Subject: save pb_modules in persistence db X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=20c38082c60f606992d3bdd921b5d7a70a993ec2;p=profitbricks%2Fjenkins-build-scripts.git save pb_modules in persistence db --- 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()