Skip to content
Snippets Groups Projects
Commit 5481c18e authored by Sebastien Luttringer's avatar Sebastien Luttringer
Browse files

image and database format use now x.y format

parent 35ed6554
No related branches found
No related tags found
No related merge requests found
...@@ -52,11 +52,11 @@ class Database(object): ...@@ -52,11 +52,11 @@ class Database(object):
r = self.ask("SELECT value FROM misc WHERE key = 'version'").fetchone() r = self.ask("SELECT value FROM misc WHERE key = 'version'").fetchone()
if r is None: if r is None:
raise TypeError() raise TypeError()
self.version = r[0] self.version = float(r[0])
except: except:
self.version = u"1" self.version = 1.0
# we only support database v1 # we only support database v1
if self.version != u"1": if self.version >= 2.0:
debug("Invalid database format: %s" % self.version) debug("Invalid database format: %s" % self.version)
raise Exception("Invalid database format") raise Exception("Invalid database format")
# we make a query to be sure format is valid # we make a query to be sure format is valid
......
...@@ -10,6 +10,7 @@ import os ...@@ -10,6 +10,7 @@ import os
import stat import stat
import time import time
import json import json
import math
import difflib import difflib
import ConfigParser import ConfigParser
import subprocess import subprocess
...@@ -32,6 +33,8 @@ class Image(object): ...@@ -32,6 +33,8 @@ class Image(object):
Abstract class of images Abstract class of images
''' '''
# format should be a float X.Y but for compatibility reason it's a string
# before version 6, it's strict string comparaison
format = "1" format = "1"
extension = ".isimage" extension = ".isimage"
...@@ -546,8 +549,17 @@ class PackageImage(Image): ...@@ -546,8 +549,17 @@ class PackageImage(Image):
desc = {} desc = {}
# check format # check format
img_format = self._tarball.get_str("format") img_format = self._tarball.get_str("format")
if img_format != self.format: try:
raise Exception("Invalid tarball image format") print img_format
print self.format
print math.floor(float(self.format)) + 1.0
#print(int(self.format) + 1)
print 'toto'
if float(img_format) >= math.floor(float(self.format)) + 1.0:
print 'otot'
raise Exception()
except:
raise Exception("Invalid image format %s" % img_format)
desc["format"] = img_format desc["format"] = img_format
# check description # check description
try: try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment