Loading installsystems/database.py +0 −35 Original line number Diff line number Diff line Loading @@ -68,38 +68,3 @@ class Database(object): Ask question to db ''' return self.conn.execute(sql, args) def add(self, image): '''Add a packaged image to a db''' try: # let's go arrow("Begin transaction to db") arrowlevel(1) self.conn.execute("BEGIN TRANSACTION") # insert image information arrow("Add image metadata") self.conn.execute("INSERT INTO image values (?,?,?,?,?,?,?)", (image.md5, image.name, image.version, image.date, image.author, image.description, image.size, )) # insert data informations arrow("Add payload metadata") for name, obj in image.payload.items(): self.conn.execute("INSERT INTO payload values (?,?,?,?,?)", (obj.md5, image.md5, name, obj.isdir, obj.size, )) # on commit arrow("Commit transaction to db") self.conn.execute("COMMIT TRANSACTION") arrowlevel(-1) except Exception as e: raise Exception("Adding metadata fail: %s" % e) installsystems/repository.py +25 −1 Original line number Diff line number Diff line Loading @@ -118,7 +118,31 @@ class Repository(object): # checking image and payload after copy r_image.check("Check image and payload after copy") # add description to db self.db.add(r_image) arrow("Adding metadata") self.db.begin() # insert image information arrow("Image", 1) self.db.ask("INSERT INTO image values (?,?,?,?,?,?,?)", (image.md5, image.name, image.version, image.date, image.author, image.description, image.size, )) # insert data informations arrow("Payloads", 1) for name, obj in image.payload.items(): self.db.ask("INSERT INTO payload values (?,?,?,?,?)", (obj.md5, image.md5, name, obj.isdir, obj.size, )) # on commit self.db.commit() # update last file self.update_last() Loading Loading
installsystems/database.py +0 −35 Original line number Diff line number Diff line Loading @@ -68,38 +68,3 @@ class Database(object): Ask question to db ''' return self.conn.execute(sql, args) def add(self, image): '''Add a packaged image to a db''' try: # let's go arrow("Begin transaction to db") arrowlevel(1) self.conn.execute("BEGIN TRANSACTION") # insert image information arrow("Add image metadata") self.conn.execute("INSERT INTO image values (?,?,?,?,?,?,?)", (image.md5, image.name, image.version, image.date, image.author, image.description, image.size, )) # insert data informations arrow("Add payload metadata") for name, obj in image.payload.items(): self.conn.execute("INSERT INTO payload values (?,?,?,?,?)", (obj.md5, image.md5, name, obj.isdir, obj.size, )) # on commit arrow("Commit transaction to db") self.conn.execute("COMMIT TRANSACTION") arrowlevel(-1) except Exception as e: raise Exception("Adding metadata fail: %s" % e)
installsystems/repository.py +25 −1 Original line number Diff line number Diff line Loading @@ -118,7 +118,31 @@ class Repository(object): # checking image and payload after copy r_image.check("Check image and payload after copy") # add description to db self.db.add(r_image) arrow("Adding metadata") self.db.begin() # insert image information arrow("Image", 1) self.db.ask("INSERT INTO image values (?,?,?,?,?,?,?)", (image.md5, image.name, image.version, image.date, image.author, image.description, image.size, )) # insert data informations arrow("Payloads", 1) for name, obj in image.payload.items(): self.db.ask("INSERT INTO payload values (?,?,?,?,?)", (obj.md5, image.md5, name, obj.isdir, obj.size, )) # on commit self.db.commit() # update last file self.update_last() Loading