Commit 5481c18e authored by Sebastien Luttringer's avatar Sebastien Luttringer
Browse files

image and database format use now x.y format

parent 35ed6554
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -52,11 +52,11 @@ class Database(object):
            r = self.ask("SELECT value FROM misc WHERE key = 'version'").fetchone()
            if r is None:
                raise TypeError()
            self.version = r[0]
            self.version = float(r[0])
        except:
            self.version = u"1"
            self.version = 1.0
        # we only support database v1
        if self.version != u"1":
        if self.version >= 2.0:
            debug("Invalid database format: %s" % self.version)
            raise Exception("Invalid database format")
        # we make a query to be sure format is valid
+14 −2
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ import os
import stat
import time
import json
import math
import difflib
import ConfigParser
import subprocess
@@ -32,6 +33,8 @@ class Image(object):
    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"
    extension = ".isimage"

@@ -546,8 +549,17 @@ class PackageImage(Image):
        desc = {}
        # check format
        img_format = self._tarball.get_str("format")
        if img_format != self.format:
            raise Exception("Invalid tarball image format")
        try:
            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
        # check description
        try: