fixed builder_update using migration mode

master 3.7.2.3
idziubenko 3 years ago
parent 9157e7061d
commit 10b5a0132d

@ -1548,7 +1548,7 @@ class Update(MethodsInterface):
return True return True
@variable_module("update") @variable_module("update")
def _search_best_binhost(self, binhosts_data, stabilization, ignore_level=False): def _search_best_binhost(self, binhosts_data, stabilization):
if not self.clVars.Get('cl_ebuild_phase'): if not self.clVars.Get('cl_ebuild_phase'):
logger = self._get_binhost_logger() logger = self._get_binhost_logger()
if logger: if logger:
@ -1558,7 +1558,6 @@ class Update(MethodsInterface):
retval = [] retval = []
skip_check_status = False skip_check_status = False
actual_reason = self.Reason.UnknownError actual_reason = self.Reason.UnknownError
# highest_level_found = int(self.clVars.Get('update.cl_update_level'))
for binhost in sorted(binhosts_data.get_binhosts(), reverse=True): for binhost in sorted(binhosts_data.get_binhosts(), reverse=True):
host = binhost.host host = binhost.host
if not binhost.valid: if not binhost.valid:
@ -1580,11 +1579,6 @@ class Update(MethodsInterface):
else: else:
# SUCCESS # SUCCESS
if not binhost.downgraded or stabilization: if not binhost.downgraded or stabilization:
# if not ignore_level and not self.is_binhost_level_valid(binhost):
# reason = self.Reason.LevelWrong
# if highest_level_found < binhost.level:
# highest_level_found = binhost.level
# else:
host = "-> %s" % host host = "-> %s" % host
reason = self.Reason.Success reason = self.Reason.Success
else: else:
@ -1613,11 +1607,6 @@ class Update(MethodsInterface):
self.Reason.Skip, self.Reason.Skip,
self.Reason.Updating): self.Reason.Updating):
raise UpdateError(_("Failed to find the server with appropriate updates")) raise UpdateError(_("Failed to find the server with appropriate updates"))
# elif actual_reason is self.Reason.LevelWrong:
# self.clVars.Set('cl_update_max_level_found', highest_level_found)#TODO change to write
# self.set_migration_mode(True)
# #TODO add translation
# raise UpdateError(_("Failed to find the server with appropriate level of updates"))
else: else:
raise UpdateError(_("Failed to find the working server with updates")) raise UpdateError(_("Failed to find the working server with updates"))
return retval return retval
@ -1642,9 +1631,10 @@ class Update(MethodsInterface):
if not binhost_url in self.binhosts_data.binhost_list: if not binhost_url in self.binhosts_data.binhost_list:
raise UpdateError(_("Current binhost is absent in list of update servers")) raise UpdateError(_("Current binhost is absent in list of update servers"))
binhost = self.binhosts_data.get_binhost(binhost_url) binhost = self.binhosts_data.get_binhost(binhost_url)
cur_level_valid = self.check_current_level() ignore_level = self.clVars.Get("cl_check_update_level") == Variable.Off
cur_level_valid = self.check_current_level() if not ignore_level else None
if binhost.valid and not binhost.outdated and not binhost.downgraded \ if binhost.valid and not binhost.outdated and not binhost.downgraded \
and (not cur_level_valid or self.is_binhost_level_valid(binhost)): and (ignore_level or not cur_level_valid or self.is_binhost_level_valid(binhost)):
if binhost.status == self.binhosts_data.BinhostStatus.Success: if binhost.status == self.binhosts_data.BinhostStatus.Success:
self.clVars.Set('update.cl_update_binhost_data', self.clVars.Set('update.cl_update_binhost_data',
[[binhost.host, binhost.data, [[binhost.host, binhost.data,
@ -1652,7 +1642,7 @@ class Update(MethodsInterface):
str(binhost.duration), str(binhost.duration),
str(binhost.level)]], str(binhost.level)]],
force=True) force=True)
if not cur_level_valid: if not ignore_level and not cur_level_valid:
self.pull_level_from_binhost(binhost) self.pull_level_from_binhost(binhost)
self.endTask() self.endTask()
else: else:
@ -1666,7 +1656,7 @@ class Update(MethodsInterface):
raise UpdateError( raise UpdateError(
_("Binary packages on the current binhost {} " _("Binary packages on the current binhost {} "
"are older than local").format(binhost_url)) "are older than local").format(binhost_url))
elif not self.is_binhost_level_valid(binhost): elif not ignore_level and not self.is_binhost_level_valid(binhost):
# self.stash_binhost(binhost_url) # self.stash_binhost(binhost_url)
self.set_migration_mode(True) self.set_migration_mode(True)
#TODO translate #TODO translate
@ -1712,25 +1702,26 @@ class Update(MethodsInterface):
stabilization = True stabilization = True
else: else:
stabilization = False stabilization = False
current_level_is_valid = self.check_current_level() ignore_level = self.clVars.Get("cl_check_update_level") == Variable.Off
current_level_is_valid = self.check_current_level() if not ignore_level else None
self.startTask(_("Searching new binhost")) self.startTask(_("Searching new binhost"))
retval = self._search_best_binhost(self.binhosts_data, retval = self._search_best_binhost(self.binhosts_data,
stabilization, stabilization)
ignore_level = not current_level_is_valid)
self.clVars.Set('update.cl_update_binhost_data', self.clVars.Set('update.cl_update_binhost_data',
retval or Variable.EmptyTable, force=True) retval or Variable.EmptyTable, force=True)
best_binhost_level = int(self.clVars.Get("update.cl_update_binhost_level")[0]) if not ignore_level:
best_binhost_level = int(self.clVars.Get("update.cl_update_binhost_level")[0])
if not current_level_is_valid: if not current_level_is_valid:
self._set_update_level(best_binhost_level) self._set_update_level(best_binhost_level)
elif self.compare_update_level(best_binhost_level) != 0: elif self.compare_update_level(best_binhost_level) != 0:
self.set_migration_mode(True) self.set_migration_mode(True)
#TODO reformulate, add translation #TODO reformulate, add translation
raise UpdateError(_("Update server's level is higher than local level")) raise UpdateError(_("Update server's level is higher than local level"))
self.endTask() self.endTask()
return True return True

@ -1892,14 +1892,6 @@ class VariableClCheckUpdateLevel(Variable):
""" """
Проверять уровень обновления Проверять уровень обновления
при соединении с binhost при соединении с binhost
NOT IMPLEMENTED YET
""" """
type = "bool" type = "bool"
value = "on" value = "on"
class VariableClUpdateMaxLevelFound(Variable):
"""
Самый высокий уровень наиденный на зеркалах
"""
type = "int"
value = "0"
Loading…
Cancel
Save