Добавлена поддержка использование testing серверов обновлений

master3.4
vanhempi 6188d9c1eb
commit d7dc318e1a

@ -1021,6 +1021,8 @@ class Update(MethodsInterface):
'cl_update_rep_name',
'cl_update_branch',
'cl_update_binhost_list',
'cl_update_binhost_unstable_list',
'cl_update_binhost_stable_set',
'cl_update_branch_name',
'cl_profile_system',
'cl_update_rep'):
@ -1175,6 +1177,11 @@ class Update(MethodsInterface):
if hosts[0] != self.clVars.Get('update.cl_update_binhost'):
self.refresh_binhost = True
self.clVars.Write('cl_update_binhost', hosts[0], location="system")
if self.clVars.Get('cl_action') == 'update':
self.clVars.Write(
'cl_update_binhost_stable_set',
self.clVars.Get('update.cl_update_binhost_stable_set'),
location="system")
new_ts = self.clVars.Get("update.cl_update_binhost_timestamp")
if new_ts:
new_ts = new_ts[0]
@ -1189,7 +1196,7 @@ class Update(MethodsInterface):
if self.refresh_binhost:
self.printWARNING(_("Update server was changed to %s") %
self.clVars.Get('cl_update_binhost'))
elif self.clVars.GetBool('update.cl_update_binhost_recheck_set'):
else:
self.printSUCCESS(_("Update server %s") %
self.clVars.Get('cl_update_binhost'))
return True
@ -1205,6 +1212,7 @@ class Update(MethodsInterface):
dv.flIniFile()
changes = False
for varname in ('update.cl_update_binhost_list',
'update.cl_update_binhost_unstable_list',
'update.cl_update_binhost_timestamp_path',
'cl_update_binhost_revision_path'):
new_value = dv.Get(varname)
@ -1213,8 +1221,10 @@ class Update(MethodsInterface):
changes = True
self.clVars.Set(varname, new_value, force=True)
if not changes:
self.clVars.Delete('cl_update_binhost', location="system")
raise UpdateError(_("Update server is unavailable"))
except DataVarsError:
self.clVars.Delete('cl_update_binhost', location="system")
raise UpdateError(_("Update server is unavailable"))
return True

@ -300,17 +300,21 @@ class VariableClUpdateBinhostData(ReadonlyTableVariable):
def get(self, hr=HumanReadable.No):
last_ts = self.Get('cl_update_last_timestamp')
if self.GetBool('cl_update_binhost_stable_set'):
binhost_list = self.Get('cl_update_binhost_list')
else:
binhost_list = self.Get('cl_update_binhost_unstable_list')
binhosts_data = Binhosts(
self.GetInteger('cl_update_binhost_timeout'),
self.Get('cl_update_binhost_revision_path'),
self.Get('cl_update_binhost_timestamp_path'),
last_ts,
self.Get('cl_update_binhost_list')
binhost_list
)
binhost = self.Get('cl_update_binhost')
recheck = self.GetBool('cl_update_binhost_recheck_set')
if not recheck and binhost:
if not recheck and binhost and binhost in binhost_list:
ts, t, good, downgrade = binhosts_data.get_timestamp(binhost)
# условие актуальности текущего сервера
if ts and good and not downgrade:
@ -333,7 +337,11 @@ class VariableClUpdateBinhostData(ReadonlyTableVariable):
data = ""
if not good:
reason = "OUTDATED"
if ts == "0":
reason = "FAILED"
t = 0
else:
reason = "OUTDATED"
elif downgrade:
reason = "SKIP"
elif not data and ret_val is None:
@ -1265,7 +1273,7 @@ class DataVarsUpdateProfile(SimpleDataVars):
'cl_update_rep_rev',
'cl_update_branch_name']
def __init__(self, profile, chroot_path='/', recheck=None):
def __init__(self, profile, chroot_path='/', recheck=None, stable=None):
SimpleDataVars.__init__(
self,
lib_linux.VariableOsLinuxName(),
@ -1303,12 +1311,16 @@ class DataVarsUpdateProfile(SimpleDataVars):
VariableClUpdateBinhostTimeout(section="update"),
VariableClUpdateBinhostTimestampPath(section="update"),
VariableClUpdateBinhostList(section="update"),
VariableClUpdateBinhostUnstableList(section="update"),
VariableClUpdateBinhostStableSet(section="update"),
VariableClUpdateBinhostRevisionPath(section="update"),
)
self['cl_profile_system'] = profile
self['cl_chroot_path'] = chroot_path
if recheck is not None:
self['cl_update_binhost_recheck_set'] = recheck
if stable is not None:
self['cl_update_binhost_stable_set'] = stable
self.flIniFileFrom(profile)
def __repr__(self):
@ -1499,7 +1511,28 @@ class VariableClUpdateBinhostList(Variable):
Список хостов с бинарными обновлениями
"""
type = "list"
value = ["ftp://ftp.calculate-linux.ru/pub/calculate"]
value = ["ftp://ftp.calculate-linux.ru/calculate"]
class VariableClUpdateBinhostUnstableList(Variable):
"""
Список хостов с бинарными обновлениями
"""
type = "list"
value = ["ftp://ftp.calculate-linux.ru/testing"]
class VariableClUpdateBinhostStableSet(Variable):
"""
Удлять лишние файлы из репозиториев (например созданные пользователем)
"""
type = "bool"
value = "on"
opt = ["--stable"]
def init(self):
self.label = _("Check the repositories integrity")
self.help = _("use only stable updates")
class VariableClUpdateBinhost(Variable):
@ -1571,6 +1604,6 @@ class VariableClUpdateEixRepositories(ReadonlyVariable):
"""
def get(self):
return ", ".join(
x for x in chain(
x.capitalize() for x in chain(
reversed(self.Get('update.cl_update_rep_name')),
self.Get('update.cl_update_other_rep_name')))

@ -64,7 +64,7 @@ class Wsdl(WsdlBase):
# описание груп (список лямбда функций)
'groups': [
lambda group: group(_("Update the system"),
normal=(),
normal=('cl_update_binhost_stable_set',),
expert=(
'cl_update_sync_only_set',
'cl_update_other_set',

Ladataan…
Peruuta
Tallenna