|
|
|
@ -34,40 +34,34 @@ import traceback
|
|
|
|
|
|
|
|
|
|
class InstallInfo(ClassSerializer):
|
|
|
|
|
"""Parameters for method install"""
|
|
|
|
|
os_location_data = Array(Array(String))
|
|
|
|
|
os_install_disk_single = String
|
|
|
|
|
os_install_mbr = Array(String)
|
|
|
|
|
os_install_root_type = String
|
|
|
|
|
cl_uuid_set = Boolean
|
|
|
|
|
cl_image_filename = String
|
|
|
|
|
cl_image_linux_shortname = String
|
|
|
|
|
cl_image_arch_machine = String
|
|
|
|
|
cl_image_linux_ver = String
|
|
|
|
|
cl_image_linux_build = String
|
|
|
|
|
cl_image_filename = String
|
|
|
|
|
|
|
|
|
|
os_install_disk_single = String
|
|
|
|
|
os_location_data = Array(Array(String))
|
|
|
|
|
os_install_mbr = Array(String)
|
|
|
|
|
os_install_root_type = String
|
|
|
|
|
os_install_scratch = Boolean
|
|
|
|
|
cl_uuid_set = Boolean
|
|
|
|
|
os_install_kernel_scheduler = String
|
|
|
|
|
|
|
|
|
|
os_install_locale_lang = String
|
|
|
|
|
os_install_clock_timezone = String
|
|
|
|
|
|
|
|
|
|
cl_migrate_data = Array(Array(String))
|
|
|
|
|
cl_autologin = String
|
|
|
|
|
#user = Array(String)
|
|
|
|
|
#autologin = String
|
|
|
|
|
#password = Array(String)
|
|
|
|
|
os_install_net_fqdn = String
|
|
|
|
|
os_install_net_data = Array(Array(String))
|
|
|
|
|
os_install_net_route_data = Array(Array(String))
|
|
|
|
|
os_install_net_conf = String
|
|
|
|
|
#netconf = String
|
|
|
|
|
#dhcp = Array(String)
|
|
|
|
|
#ip = Array(String)
|
|
|
|
|
#route = Array(Array(String))
|
|
|
|
|
#dns = Array(String)
|
|
|
|
|
#proxy = String
|
|
|
|
|
os_install_ntp = String
|
|
|
|
|
os_install_x11_video_drv = String
|
|
|
|
|
os_install_x11_resolution = String
|
|
|
|
|
os_install_x11_composite = Boolean
|
|
|
|
|
os_install_fb_resolution = String
|
|
|
|
|
os_install_clock_timezone = String
|
|
|
|
|
os_install_kernel_scheduler = String
|
|
|
|
|
|
|
|
|
|
cl_autopartition_device = String
|
|
|
|
|
cl_autopartition_scheme = String
|
|
|
|
@ -106,37 +100,6 @@ def catchExcept():
|
|
|
|
|
return wrapper
|
|
|
|
|
|
|
|
|
|
class Wsdl:
|
|
|
|
|
def check_params (self, dv, info,allvars=False,ordered=None):
|
|
|
|
|
errors = []
|
|
|
|
|
keys = sorted(filter(lambda x:x.lower() == x,
|
|
|
|
|
info._type_info.keys()))
|
|
|
|
|
if ordered:
|
|
|
|
|
keys = ordered + filter(lambda x:not x in ordered,
|
|
|
|
|
keys)
|
|
|
|
|
for var in keys:
|
|
|
|
|
# get value of variable from info
|
|
|
|
|
val = info.__getattribute__(var)
|
|
|
|
|
# check value if value send of check allvariables
|
|
|
|
|
if val != None or allvars:
|
|
|
|
|
try:
|
|
|
|
|
# if value not send, then get from datavars
|
|
|
|
|
if val == None:
|
|
|
|
|
val = dv.Get(var)
|
|
|
|
|
else:
|
|
|
|
|
uncomperr = dv.Uncompatible(var)
|
|
|
|
|
if uncomperr:
|
|
|
|
|
raise VariableError(uncomperr)
|
|
|
|
|
if not dv.Uncompatible(var):
|
|
|
|
|
dv.Set(var, val)
|
|
|
|
|
except VariableError, e:
|
|
|
|
|
mess = ''
|
|
|
|
|
messages = e.message if type(e.message) == list else [e.message]
|
|
|
|
|
for error in messages:
|
|
|
|
|
mess += str(error) + '\n'
|
|
|
|
|
errors.append(ReturnedMessage(type = 'error', field = var,
|
|
|
|
|
message = mess))
|
|
|
|
|
return errors
|
|
|
|
|
|
|
|
|
|
from calculate.api.server.baseClass import Basic
|
|
|
|
|
from calculate.api.server.decorators import Dec
|
|
|
|
|
|
|
|
|
@ -147,20 +110,11 @@ class Wsdl:
|
|
|
|
|
try:
|
|
|
|
|
dv = self.get_cache(sid,methodname,"vars")
|
|
|
|
|
if not dv:
|
|
|
|
|
reload(cl_install)
|
|
|
|
|
dv = cl_install.DataVarsInstall()
|
|
|
|
|
dv.importInstall()
|
|
|
|
|
dv.flIniFile()
|
|
|
|
|
initfunc(dv)
|
|
|
|
|
errors = self.check_params(dv, info,
|
|
|
|
|
ordered=['cl_autopartition_scheme',
|
|
|
|
|
'cl_autopartition_device',
|
|
|
|
|
'cl_autopartition_root_size',
|
|
|
|
|
'cl_image_linux_shortname',
|
|
|
|
|
'cl_image_arch_machine',
|
|
|
|
|
'cl_image_linux_ver',
|
|
|
|
|
'cl_image_linux_build'],
|
|
|
|
|
allvars=not info.CheckOnly)
|
|
|
|
|
dv = initfunc()
|
|
|
|
|
else:
|
|
|
|
|
dv.processRefresh()
|
|
|
|
|
errors = map(lambda x:ReturnedMessage(**x),
|
|
|
|
|
dv.checkGroups(info,allvars=not info.CheckOnly))
|
|
|
|
|
if errors:
|
|
|
|
|
return errors
|
|
|
|
|
if info.CheckOnly:
|
|
|
|
@ -186,9 +140,38 @@ class Wsdl:
|
|
|
|
|
@Dec.console('cl-install')
|
|
|
|
|
@Dec.gui(_('System'),_('Install'),'drive-harddisk')
|
|
|
|
|
def install ( self, sid, info):
|
|
|
|
|
def init_func(dv):
|
|
|
|
|
dv.Set('cl_action','system',True)
|
|
|
|
|
return self.installCommon(sid,info,'install',init_func)
|
|
|
|
|
return self.installCommon(sid,info,'install',self.install_vars)
|
|
|
|
|
|
|
|
|
|
def install_vars(self):
|
|
|
|
|
reload(cl_install)
|
|
|
|
|
dv = cl_install.DataVarsInstall()
|
|
|
|
|
dv.importInstall()
|
|
|
|
|
dv.flIniFile()
|
|
|
|
|
dv.Set('cl_action','system',True)
|
|
|
|
|
dv.addGroup(_("Distribute"),
|
|
|
|
|
normal=('cl_image_filename',),
|
|
|
|
|
expert=('cl_image_linux_shortname', 'cl_image_arch_machine',
|
|
|
|
|
'cl_image_linux_ver', 'cl_image_linux_build'))
|
|
|
|
|
dv.addGroup(_("Autopartition"),
|
|
|
|
|
normal=('cl_autopartition_scheme','cl_autopartition_device'),
|
|
|
|
|
expert=('cl_autopartition_table','cl_autopartition_root_size'))
|
|
|
|
|
dv.addGroup(_("Partitioning"),
|
|
|
|
|
normal=('os_location_data','os_install_scratch','cl_uuid_set'),
|
|
|
|
|
expert=('os_install_root_type','os_install_mbr',
|
|
|
|
|
'os_install_kernel_scheduler'))
|
|
|
|
|
dv.addGroup(_("Locale"),
|
|
|
|
|
normal=('os_install_locale_lang','os_install_clock_timezone'))
|
|
|
|
|
dv.addGroup(_("Networking"),
|
|
|
|
|
normal=('os_install_net_conf','os_install_net_data',
|
|
|
|
|
'os_install_net_fqdn','os_install_ntp'),
|
|
|
|
|
expert=('os_install_net_route_data',))
|
|
|
|
|
dv.addGroup(_("Users"),
|
|
|
|
|
normal=('cl_migrate_data','cl_autologin'))
|
|
|
|
|
dv.addGroup(_("Video"),
|
|
|
|
|
normal=('os_install_x11_video_drv','os_install_x11_composite',
|
|
|
|
|
'os_install_x11_resolution','os_install_fb_resolution'),
|
|
|
|
|
next_label=_("Install"))
|
|
|
|
|
return dv
|
|
|
|
|
|
|
|
|
|
@rpc(Integer, Integer, Boolean,_returns = ViewInfo)
|
|
|
|
|
@catchExcept()
|
|
|
|
@ -196,45 +179,26 @@ class Wsdl:
|
|
|
|
|
curThread = threading.currentThread()
|
|
|
|
|
dv = self.get_cache(sid,"install","vars")
|
|
|
|
|
if not dv:
|
|
|
|
|
reload(cl_install)
|
|
|
|
|
dv = cl_install.DataVarsInstall()
|
|
|
|
|
dv.importInstall()
|
|
|
|
|
dv.flIniFile()
|
|
|
|
|
dv.Set('cl_action','system',True)
|
|
|
|
|
view = getViewForVariables (dv, [
|
|
|
|
|
(_("Distribute"), \
|
|
|
|
|
('cl_image_filename',),
|
|
|
|
|
('cl_image_linux_shortname','cl_image_arch_machine',
|
|
|
|
|
'cl_image_linux_ver','cl_image_linux_build'),
|
|
|
|
|
_("Next")), \
|
|
|
|
|
(_("Autopartition"), \
|
|
|
|
|
('cl_autopartition_device',
|
|
|
|
|
'cl_autopartition_scheme'),
|
|
|
|
|
('cl_autopartition_table','cl_autopartition_root_size'),
|
|
|
|
|
_("Next")), \
|
|
|
|
|
(_("Partitioning"), \
|
|
|
|
|
('os_location_data','os_install_scratch','cl_uuid_set'),
|
|
|
|
|
('os_install_root_type','os_install_mbr',
|
|
|
|
|
'os_install_kernel_scheduler'),
|
|
|
|
|
_("Next")), \
|
|
|
|
|
(_("Locale"), \
|
|
|
|
|
('os_install_locale_lang','os_install_clock_timezone'),(), \
|
|
|
|
|
_("Next")),
|
|
|
|
|
(_("Networking"), \
|
|
|
|
|
('os_install_net_conf','os_install_net_data','os_install_net_fqdn',
|
|
|
|
|
'os_install_ntp'),('os_install_net_route_data',), \
|
|
|
|
|
_("Next")),
|
|
|
|
|
(_("Users"), \
|
|
|
|
|
('cl_migrate_data','cl_autologin'),(), \
|
|
|
|
|
_("Next")),
|
|
|
|
|
(_("Video"), \
|
|
|
|
|
('os_install_x11_video_drv', 'os_install_x11_composite',
|
|
|
|
|
'os_install_x11_resolution', 'os_install_fb_resolution'),(), \
|
|
|
|
|
_("Install")),
|
|
|
|
|
],step,expert)
|
|
|
|
|
dv = self.install_vars()
|
|
|
|
|
else:
|
|
|
|
|
dv.processRefresh()
|
|
|
|
|
view = getViewForVariables (dv,step,expert)
|
|
|
|
|
self.set_cache(sid, 'install', "vars",dv,smart=False)
|
|
|
|
|
return view
|
|
|
|
|
|
|
|
|
|
def install_flash_vars(self):
|
|
|
|
|
reload(cl_install)
|
|
|
|
|
dv = cl_install.DataVarsInstall()
|
|
|
|
|
dv.importInstall()
|
|
|
|
|
dv.flIniFile()
|
|
|
|
|
dv.Set('cl_action','system',True)
|
|
|
|
|
dv.Set('cl_install_type','flash')
|
|
|
|
|
dv.addGroup(_("Flash install"),
|
|
|
|
|
normal=('os_install_disk_single','cl_image_filename'),
|
|
|
|
|
expert=('os_location_data',),
|
|
|
|
|
next_label=_("Install"))
|
|
|
|
|
return dv
|
|
|
|
|
|
|
|
|
|
@rpc(Integer, InstallInfo, _returns = Array(ReturnedMessage))
|
|
|
|
|
@Dec.check_permissions(["install"])
|
|
|
|
|
@Dec.gui(_('System'),_('Flash install'),
|
|
|
|
@ -243,27 +207,17 @@ class Wsdl:
|
|
|
|
|
"""
|
|
|
|
|
Install to flash
|
|
|
|
|
"""
|
|
|
|
|
def init_func(dv):
|
|
|
|
|
dv.Set('cl_action','system',True)
|
|
|
|
|
dv.Set('cl_install_type','flash')
|
|
|
|
|
return self.installCommon(sid,info,'install_flash',init_func)
|
|
|
|
|
return self.installCommon(sid,info,'install_flash',
|
|
|
|
|
self.install_flash_vars)
|
|
|
|
|
|
|
|
|
|
@rpc(Integer, Integer, Boolean,_returns = ViewInfo)
|
|
|
|
|
@catchExcept()
|
|
|
|
|
def install_flash_view (self, sid, step,expert):
|
|
|
|
|
dv = self.get_cache(sid,"install_flash","vars")
|
|
|
|
|
if not dv:
|
|
|
|
|
reload(cl_install)
|
|
|
|
|
dv = cl_install.DataVarsInstall()
|
|
|
|
|
dv.importInstall()
|
|
|
|
|
dv.flIniFile()
|
|
|
|
|
dv.Set('cl_action','system',True)
|
|
|
|
|
dv.Set('cl_install_type','flash')
|
|
|
|
|
view = getViewForVariables (dv, [
|
|
|
|
|
(_("Distribute"), \
|
|
|
|
|
('os_install_disk_single','cl_image_filename'),
|
|
|
|
|
('os_location_data',),
|
|
|
|
|
_("Install")), \
|
|
|
|
|
],step,expert)
|
|
|
|
|
dv = self.install_flash_vars()
|
|
|
|
|
else:
|
|
|
|
|
dv.processRefresh()
|
|
|
|
|
view = getViewForVariables (dv,step,expert)
|
|
|
|
|
self.set_cache(sid, 'install_flash', "vars",dv,smart=False)
|
|
|
|
|
return view
|
|
|
|
|