]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
save pb_modules in persistence db
authorHolger Levsen <holger@layer-acht.org>
Wed, 2 Nov 2011 12:47:05 +0000 (13:47 +0100)
committerHolger Levsen <holger@layer-acht.org>
Wed, 2 Nov 2011 12:47:05 +0000 (13:47 +0100)
kernel_inpbuilder.py
kernel_persistence.py

index 63d858ee4d70f1251069e3d419b22c3e03d5b647..02c672a251a213c521388b89a64cc9435049f799 100644 (file)
@@ -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
 
index 9855604ead506fb8eb1cdf0c2faca0b9ba518d14..973909e48d86c51dce4e382bb4786e913b6e83d1 100644 (file)
@@ -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()