From: Holger Levsen Date: Wed, 2 Nov 2011 10:48:16 +0000 (+0100) Subject: fix X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=67e08955cfeb1cc170feedda69ed3979253ecb4c;p=profitbricks%2Fjenkins-build-scripts.git fix --- diff --git a/kernel_build.py b/kernel_build.py index 5a7828f..7ae3903 100644 --- a/kernel_build.py +++ b/kernel_build.py @@ -137,9 +137,9 @@ def exit_error(): if __name__ == '__main__': logger.debug('running with this enviroment: %s', os.environ) atexit.register(remove_git_target_workspace) - kernel_revision_obj = get_last_kernel_revision_obj() + kernel_revision_obj = kernel_persistence.get_last_kernel_revision_obj() new_version = kernel_revision_obj.last_version + 1 - if not update_kernel_revision_obj(kernel_revision_obj, new_version): + if not kernel_persistance.update_kernel_revision_obj(kernel_revision_obj, new_version): logger.info( 'Could not update persistence version to %s for %s' %(new_version, GIT_BRANCH_NAME) diff --git a/kernel_persistance.py b/kernel_persistance.py index 58ae796..e0d9c9a 100644 --- a/kernel_persistance.py +++ b/kernel_persistance.py @@ -12,9 +12,9 @@ CWD = os.environ.get('WORKSPACE') PERSISTENCE_FILE = os.path.join(CWD, '..', '.persistence') Base = declarative_base() - engine = create_engine('sqlite:///%s' %(PERSISTENCE_FILE)) Session = sessionmaker(bind=engine) +Base.metadata.create_all(engine) class KernelVersion(Base): __tablename__ = 'branch_kernel_version' @@ -35,8 +35,6 @@ class KernelVersion(Base): self.identifier, self.last_version ) -Base.metadata.create_all(engine) - def get_last_kernel_revision_obj(): session = Session() logger.debug('Getting kernel revision from persistence') @@ -79,5 +77,3 @@ def update_kernel_revision_obj(kernel_version_obj, new_revision): return True finally: session.close() - -