Add --update option

master3.3
Mike Hiretsky 11 years ago
parent b85789f8a4
commit fcba8b9c1d

@ -42,6 +42,7 @@ __ = getLazyLocalTranslate(_)
class InstallInfo(CommonInfo):
"""Parameters for method install"""
cl_image_filename = String
cl_image_new_only = Boolean
cl_image_linux_shortname = String
cl_image_arch_machine = String
cl_image_linux_ver = String
@ -113,7 +114,7 @@ class Wsdl:
normal=('os_install_locale_lang','os_install_clock_timezone'))
dv.addGroup(_("Distribution"),
normal=('cl_image_filename',),
expert=('cl_image_linux_shortname', 'cl_image_arch_machine'))
expert=('cl_image_linux_shortname', 'cl_image_arch_machine','cl_image_new_only'))
dv.addGroup(_("Allocate drive space"),
normal=('cl_autopartition_set',),
expert=('cl_autopartition_scheme','cl_autopartition_device',

@ -20,7 +20,8 @@ from os import path
import re
import operator
from operator import itemgetter
from calculate.lib.datavars import Variable,VariableError,ReadonlyVariable
from calculate.lib.datavars import Variable,VariableError,ReadonlyVariable, \
CommonVariableError
from calculate.lib.utils.common import getSupportArch,getTupleVersion, \
cmpVersion
from calculate.lib.utils.files import readLinesFile, listDirectory
@ -294,6 +295,7 @@ class VariableClImageFilename(Variable,DistroRepository):
if not("os_linux_shortname" in imageData and \
imageData.get('os_linux_build','') and \
"os_arch_machine" in imageData):
print imageData,isoimage
raise VariableError(_("Wrong image file"))
def humanImageName(self,distroinfo,filepath):
@ -514,3 +516,42 @@ class VariableClTarget(ReadonlyVariable):
systemId=None,
partitionTable='')
return target
class VariableClImageNewOnly(Variable):
"""
Distributive image filename
"""
type = 'bool'
opt = ['-U','--update']
value = "off"
def init(self):
self.label = _("Install newer images only")
self.help = _("install newer images only")
def installedBuild(self):
"""
Get build already installed system
Need for check update
"""
imageData = None
rootDev = self.Get('os_install_root_dev')
if not rootDev:
return ""
try:
imageData = Distributive().getInfo(rootDev)
return imageData.get('os_linux_build','')
except:
pass
return ""
def check(self,value):
if value == 'on':
try:
imageData = Distributive().getInfo(self.Get('cl_image_filename'))
except Exception as e:
raise VariableError(_("Wrong image file"))
if imageData.get('os_linux_build','') <= \
self.Get('os_linux_build') or \
imageData.get('os_linux_build','') <= self.installedBuild():
raise CommonVariableError(_("The image for update not found"))

Loading…
Cancel
Save