From 3b79f758eb88c0834540641a917c1b7893d3a989 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD=20=D0=94=D0=B7=D1=8E=D0=B1=D0=B5?= =?UTF-8?q?=D0=BD=D0=BA=D0=BE?= Date: Thu, 28 Oct 2021 17:32:26 +0300 Subject: [PATCH] progress --- pym/update/update.py | 30 ++++++++++++++++-------------- pym/update/utils/cl_update.py | 10 ++++++---- pym/update/variables/update.py | 3 +-- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/pym/update/update.py b/pym/update/update.py index d869ce7..ad7daba 100644 --- a/pym/update/update.py +++ b/pym/update/update.py @@ -1575,13 +1575,15 @@ class Update(MethodsInterface): reason = errors.get(status, self.Reason.UnknownError) elif binhost.bad_sign: reason = self.Reason.BadSign - elif not self.is_binhost_level_valid(binhost): - reason = self.Reason.LevelWrong + else: # SUCCESS if not binhost.downgraded or stabilization: - host = "-> %s" % host - reason = self.Reason.Success + if not self.is_binhost_level_valid(binhost): + reason = self.Reason.LevelWrong + else: + host = "-> %s" % host + reason = self.Reason.Success else: reason = self.Reason.Skip elif binhost.downgraded: @@ -1653,7 +1655,7 @@ class Update(MethodsInterface): self.clVars.Set("update.cl_update_use_migration_host", Variable.On) #TODO translate raise UpdateError( - _("Current binhost {} has wrong update level. Current level: {} Binhost level: {}").\ + _("Current binhost {} has a wrong update level. Current level: {} Binhost level: {}").\ format(binhost_url, self.clVars.Get("update.cl_update_level"), binhost.level, )) elif binhost.outdated: raise UpdateError( @@ -1689,7 +1691,7 @@ class Update(MethodsInterface): return True def get_migration_mirror_url(self, host, level): - return f"{host}level{level}/" + return f"{host}level{level}" @variable_module("update") def detect_best_binhost(self): @@ -1710,7 +1712,6 @@ class Update(MethodsInterface): return True def set_migration_host(self): - print("TESTTEST") retval = [] dv = self.clVars last_ts = dv.Get('cl_update_last_timestamp') @@ -1718,7 +1719,6 @@ class Update(MethodsInterface): level = self.clVars.Get('update.cl_update_level') binhost_list = [self.get_migration_mirror_url(x, level) for x in binhost_list] binhosts_data = Binhosts( - # значение малозначимо, поэтому берётся из собирающей системы dv.GetInteger('cl_update_binhost_timeout'), dv.Get('cl_update_binhost_revision_path'), dv.Get('cl_update_binhost_timestamp_path'), @@ -1729,7 +1729,11 @@ class Update(MethodsInterface): retval.append([migration_host.host, migration_host.data, str(migration_host.timestamp), str(migration_host.duration)]) - return retval + self.clVars.Set('update.cl_update_binhost_data', + retval or Variable.EmptyTable, force=True) + + self.endTask() + return True def update_rep_list(self): @@ -1817,9 +1821,7 @@ class Update(MethodsInterface): except Exception: pass return True - + def update_set_current_level(self): - # print("DEBUG") - # self.clVars.Get('update.cl_update_binhost')) - self.printSUCCESS(_("UPDATE LEVEL %s") % self.clVars.Get('update.cl_update_level')) - return True + self.clVars.Set('update.cl_update_level', + Variable.On, force=True) \ No newline at end of file diff --git a/pym/update/utils/cl_update.py b/pym/update/utils/cl_update.py index bdc1f6d..4909311 100644 --- a/pym/update/utils/cl_update.py +++ b/pym/update/utils/cl_update.py @@ -451,10 +451,12 @@ class ClUpdateAction(Action): 'depend': Tasks.failed() }, # #TODO - # {'name': 'update:set_current_level', - # 'method': 'Update.update_set_current_level()', - # 'condition': lambda Get: Get('cl_update_sync_only_set') == 'off' - # }, + {'name': 'update:set_current_level', + 'method': 'Update.update_set_current_level()', + 'depend': Tasks.success(), + 'condition': lambda Get: Get('cl_update_sync_only_set') == 'off' and + Get('update.cl_update_use_migration_host') == 'on' + }, # сообщение удачного завершения при обновлении ревизии {'name': 'success_rev', 'message': __("System update finished!"), diff --git a/pym/update/variables/update.py b/pym/update/variables/update.py index f3a38cb..8fa3f55 100644 --- a/pym/update/variables/update.py +++ b/pym/update/variables/update.py @@ -1566,7 +1566,6 @@ class VariableClUpdateBinhostMigrationList(Variable): Список хостов с бинарными обновлениями для стабильной миграции """ type = "list" - #TODO placeholder value = ["https://mirror.calculate-linux.org/migrate/"] class VariableClUpdateBinhostBase(Variable): @@ -1858,7 +1857,7 @@ class VariableClUpdateLevel(Variable): Текущий уровень обновления Используется для выбора зеркала """ - value = "1" + value = "0" class VariableClUpdateUseMigrationHost(Variable): """