|
|
|
@ -1516,7 +1516,7 @@ class Update(MethodsInterface):
|
|
|
|
|
Update.Reason.SkipSlower: "",
|
|
|
|
|
Update.Reason.Success: "",
|
|
|
|
|
#TODO formulate better
|
|
|
|
|
Update.Reason.LevelWrong: "FAILED (binhost level is wrong)"
|
|
|
|
|
# Update.Reason.LevelWrong: "FAILED (binhost level is wrong)"
|
|
|
|
|
}.get(reason,reason)
|
|
|
|
|
|
|
|
|
|
def _get_binhost_logger(self):
|
|
|
|
@ -1580,13 +1580,13 @@ class Update(MethodsInterface):
|
|
|
|
|
else:
|
|
|
|
|
# SUCCESS
|
|
|
|
|
if not binhost.downgraded or stabilization:
|
|
|
|
|
if not ignore_level and not self.is_binhost_level_valid(binhost):
|
|
|
|
|
reason = self.Reason.LevelWrong
|
|
|
|
|
# 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
|
|
|
|
|
reason = self.Reason.Success
|
|
|
|
|
# else:
|
|
|
|
|
host = "-> %s" % host
|
|
|
|
|
reason = self.Reason.Success
|
|
|
|
|
else:
|
|
|
|
|
reason = self.Reason.Skip
|
|
|
|
|
elif binhost.downgraded:
|
|
|
|
@ -1613,26 +1613,26 @@ class Update(MethodsInterface):
|
|
|
|
|
self.Reason.Skip,
|
|
|
|
|
self.Reason.Updating):
|
|
|
|
|
raise UpdateError(_("Failed to find the server with appropriate updates"))
|
|
|
|
|
elif actual_reason is self.Reason.LevelWrong:
|
|
|
|
|
# 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"))
|
|
|
|
|
# self.set_migration_mode(True)
|
|
|
|
|
# #TODO add translation
|
|
|
|
|
# raise UpdateError(_("Failed to find the server with appropriate level of updates"))
|
|
|
|
|
else:
|
|
|
|
|
raise UpdateError(_("Failed to find the working server with updates"))
|
|
|
|
|
return retval
|
|
|
|
|
|
|
|
|
|
def is_binhost_level_valid(self, binhost):
|
|
|
|
|
return self.compare_update_level(binhost) == 0
|
|
|
|
|
return self.compare_update_level(binhost.level) == 0
|
|
|
|
|
|
|
|
|
|
# @variable_module("update")
|
|
|
|
|
def compare_update_level(self, binhost):
|
|
|
|
|
def compare_update_level(self, level):
|
|
|
|
|
# < 0 binhost level low
|
|
|
|
|
# == 0 binhost level adequate
|
|
|
|
|
# > 0 binhost level high
|
|
|
|
|
if binhost.level is None:
|
|
|
|
|
if level is None:
|
|
|
|
|
return None
|
|
|
|
|
return binhost.level - int(self.clVars.Get("update.cl_update_level"))
|
|
|
|
|
return level - int(self.clVars.Get("update.cl_update_level"))
|
|
|
|
|
|
|
|
|
|
def check_current_binhost(self, binhost_url):
|
|
|
|
|
"""
|
|
|
|
@ -1722,9 +1722,16 @@ class Update(MethodsInterface):
|
|
|
|
|
self.clVars.Set('update.cl_update_binhost_data',
|
|
|
|
|
retval or Variable.EmptyTable, force=True)
|
|
|
|
|
|
|
|
|
|
best_binhost_level = int(self.clVars.Get("update.cl_update_binhost_level")[0])
|
|
|
|
|
|
|
|
|
|
if not current_level_is_valid:
|
|
|
|
|
level = int(self.clVars.Get("update.cl_update_binhost_level")[0])
|
|
|
|
|
self._set_update_level(level)
|
|
|
|
|
self._set_update_level(best_binhost_level)
|
|
|
|
|
|
|
|
|
|
elif self.compare_update_level(best_binhost_level) != 0:
|
|
|
|
|
self.set_migration_mode(True)
|
|
|
|
|
#TODO reformulate, add translation
|
|
|
|
|
raise UpdateError(_("Update server's level is higher than local level"))
|
|
|
|
|
|
|
|
|
|
self.endTask()
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|