From d7dc318e1adaadf5e8a2d22c42d240498206a31e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A5=D0=B8=D1=80=D0=B5=D1=86=D0=BA=D0=B8=D0=B9=20=D0=9C?= =?UTF-8?q?=D0=B8=D1=85=D0=B0=D0=B8=D0=BB?= Date: Wed, 30 Mar 2016 16:59:48 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BF=D0=BE=D0=B4=D0=B4=D0=B5=D1=80=D0=B6=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=B5=20testing=20=D1=81=D0=B5=D1=80=D0=B2?= =?UTF-8?q?=D0=B5=D1=80=D0=BE=D0=B2=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pym/update/update.py | 12 ++++++++- pym/update/variables/update.py | 45 +++++++++++++++++++++++++++++----- pym/update/wsdl_update.py | 2 +- 3 files changed, 51 insertions(+), 8 deletions(-) diff --git a/pym/update/update.py b/pym/update/update.py index 7c9a4b2..2d1c53c 100644 --- a/pym/update/update.py +++ b/pym/update/update.py @@ -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 diff --git a/pym/update/variables/update.py b/pym/update/variables/update.py index 75275c3..fadc949 100644 --- a/pym/update/variables/update.py +++ b/pym/update/variables/update.py @@ -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'))) diff --git a/pym/update/wsdl_update.py b/pym/update/wsdl_update.py index fbf44ad..46e74fa 100644 --- a/pym/update/wsdl_update.py +++ b/pym/update/wsdl_update.py @@ -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',