migration_mirror 3.7.1.3
Иван Дзюбенко 3 years ago
parent 4c1f92d549
commit 3b79f758eb

@ -1575,13 +1575,15 @@ class Update(MethodsInterface):
reason = errors.get(status, self.Reason.UnknownError) reason = errors.get(status, self.Reason.UnknownError)
elif binhost.bad_sign: elif binhost.bad_sign:
reason = self.Reason.BadSign reason = self.Reason.BadSign
elif not self.is_binhost_level_valid(binhost):
reason = self.Reason.LevelWrong
else: else:
# SUCCESS # SUCCESS
if not binhost.downgraded or stabilization: if not binhost.downgraded or stabilization:
host = "-> %s" % host if not self.is_binhost_level_valid(binhost):
reason = self.Reason.Success reason = self.Reason.LevelWrong
else:
host = "-> %s" % host
reason = self.Reason.Success
else: else:
reason = self.Reason.Skip reason = self.Reason.Skip
elif binhost.downgraded: elif binhost.downgraded:
@ -1653,7 +1655,7 @@ class Update(MethodsInterface):
self.clVars.Set("update.cl_update_use_migration_host", Variable.On) self.clVars.Set("update.cl_update_use_migration_host", Variable.On)
#TODO translate #TODO translate
raise UpdateError( 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, )) format(binhost_url, self.clVars.Get("update.cl_update_level"), binhost.level, ))
elif binhost.outdated: elif binhost.outdated:
raise UpdateError( raise UpdateError(
@ -1689,7 +1691,7 @@ class Update(MethodsInterface):
return True return True
def get_migration_mirror_url(self, host, level): def get_migration_mirror_url(self, host, level):
return f"{host}level{level}/" return f"{host}level{level}"
@variable_module("update") @variable_module("update")
def detect_best_binhost(self): def detect_best_binhost(self):
@ -1710,7 +1712,6 @@ class Update(MethodsInterface):
return True return True
def set_migration_host(self): def set_migration_host(self):
print("TESTTEST")
retval = [] retval = []
dv = self.clVars dv = self.clVars
last_ts = dv.Get('cl_update_last_timestamp') last_ts = dv.Get('cl_update_last_timestamp')
@ -1718,7 +1719,6 @@ class Update(MethodsInterface):
level = self.clVars.Get('update.cl_update_level') level = self.clVars.Get('update.cl_update_level')
binhost_list = [self.get_migration_mirror_url(x, level) for x in binhost_list] binhost_list = [self.get_migration_mirror_url(x, level) for x in binhost_list]
binhosts_data = Binhosts( binhosts_data = Binhosts(
# значение малозначимо, поэтому берётся из собирающей системы
dv.GetInteger('cl_update_binhost_timeout'), dv.GetInteger('cl_update_binhost_timeout'),
dv.Get('cl_update_binhost_revision_path'), dv.Get('cl_update_binhost_revision_path'),
dv.Get('cl_update_binhost_timestamp_path'), dv.Get('cl_update_binhost_timestamp_path'),
@ -1729,7 +1729,11 @@ class Update(MethodsInterface):
retval.append([migration_host.host, migration_host.data, retval.append([migration_host.host, migration_host.data,
str(migration_host.timestamp), str(migration_host.timestamp),
str(migration_host.duration)]) 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): def update_rep_list(self):
@ -1817,9 +1821,7 @@ class Update(MethodsInterface):
except Exception: except Exception:
pass pass
return True return True
def update_set_current_level(self): def update_set_current_level(self):
# print("DEBUG") self.clVars.Set('update.cl_update_level',
# self.clVars.Get('update.cl_update_binhost')) Variable.On, force=True)
self.printSUCCESS(_("UPDATE LEVEL %s") % self.clVars.Get('update.cl_update_level'))
return True

@ -451,10 +451,12 @@ class ClUpdateAction(Action):
'depend': Tasks.failed() 'depend': Tasks.failed()
}, },
# #TODO # #TODO
# {'name': 'update:set_current_level', {'name': 'update:set_current_level',
# 'method': 'Update.update_set_current_level()', 'method': 'Update.update_set_current_level()',
# 'condition': lambda Get: Get('cl_update_sync_only_set') == 'off' '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', {'name': 'success_rev',
'message': __("System update finished!"), 'message': __("System update finished!"),

@ -1566,7 +1566,6 @@ class VariableClUpdateBinhostMigrationList(Variable):
Список хостов с бинарными обновлениями для стабильной миграции Список хостов с бинарными обновлениями для стабильной миграции
""" """
type = "list" type = "list"
#TODO placeholder
value = ["https://mirror.calculate-linux.org/migrate/"] value = ["https://mirror.calculate-linux.org/migrate/"]
class VariableClUpdateBinhostBase(Variable): class VariableClUpdateBinhostBase(Variable):
@ -1858,7 +1857,7 @@ class VariableClUpdateLevel(Variable):
Текущий уровень обновления Текущий уровень обновления
Используется для выбора зеркала Используется для выбора зеркала
""" """
value = "1" value = "0"
class VariableClUpdateUseMigrationHost(Variable): class VariableClUpdateUseMigrationHost(Variable):
""" """

Loading…
Cancel
Save