From: Holger Levsen Date: Wed, 2 Nov 2011 12:21:26 +0000 (+0100) Subject: revert last commit and try something else X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=c05f92673fef7ad2330ee0ea481f7d8e565ad2b7;p=profitbricks%2Fjenkins-build-scripts.git revert last commit and try something else --- diff --git a/kernel_persistence.py b/kernel_persistence.py index 56a0d57..9855604 100644 --- a/kernel_persistence.py +++ b/kernel_persistence.py @@ -17,7 +17,6 @@ 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) # FIXME: move this into own logger Class logger = logging.getLogger(sys.argv[0]) @@ -47,6 +46,8 @@ class KernelVersion(Base): self.identifier, self.last_version, self.branch_name, self.pb_modules ) +Base.metadata.create_all(engine) + def get_last_kernel_revision_obj(branch): session = Session() logger.debug('Getting kernel revision from persistence') @@ -63,7 +64,7 @@ def get_last_kernel_revision_obj(branch): try: answ = session.query(KernelVersion).filter( KernelVersion.identifier == persistence_identifier).one() - except: + except NoResultFound: session.add(KernelVersion(persistence_identifier, 0, branch, '')) session.commit() answ = session.query(KernelVersion).filter(