diff --git a/pym/update/update.py b/pym/update/update.py index 19ee651..96a09e2 100644 --- a/pym/update/update.py +++ b/pym/update/update.py @@ -1722,13 +1722,19 @@ class Update(MethodsInterface): self.clVars.Set('update.cl_update_binhost_data', retval or Variable.EmptyTable, force=True) + if not current_level_is_valid: + level = int(self.clVars.Get("update.cl_update_binhost_level")[0]) + self._set_update_level(level) self.endTask() return True def set_migration_mode(self, val=True): val_to_write = Variable.On if val else Variable.Off - self.clVars.Write("cl_update_use_migration_host", val_to_write, location="system") - + # self.clVars.Write("cl_update_use_migration_host", val_to_write, location="system") + self.clVars.Set("cl_update_use_migration_host", val_to_write) + return True + + def set_migration_host(self): #TODO translate self.startTask(_("Setting up migration host")) @@ -1736,26 +1742,16 @@ class Update(MethodsInterface): last_ts = dv.Get('cl_update_last_timestamp') binhost_list = dv.Get('cl_update_binhost_migration_list') level = int(dv.Get('update.cl_update_level')) - # max_level = int(dv.Get('cl_update_max_level_found')) migration_host = None migr_binhost_data = [] - # level_did_increase = False # one cl-update - one update_level increase max? - # while level < max_level: - # while True: migration_host_candidate = self._choose_migration_host(level, binhost_list, last_ts) if migration_host_candidate.bad_sign or \ migration_host_candidate.status != 0: pass - # break - # elif migration_host_candidate.downgraded: - # self._update_increment_current_level() - # level += 1 - # level_did_increase = True else: migration_host = migration_host_candidate # break - if migration_host: migr_binhost_data = [[migration_host.host, migration_host.data, str(migration_host.timestamp), @@ -1872,7 +1868,7 @@ class Update(MethodsInterface): self.startTask(_("Increasing update level")) self._update_increment_current_level() self.set_migration_mode(False) - self.unstash_binhost() + # self.unstash_binhost() self.delete_binhost() self.endTask() return True @@ -1890,11 +1886,16 @@ class Update(MethodsInterface): def pull_level_from_binhost(self, binhost): - if binhost.level: + self._set_update_level(binhost.level) + + def _set_update_level(self, level): + if level: self.clVars.Write('cl_update_level', - str(binhost.level), location="system") + str(level), location="system") return True else: + self.clVars.Write('cl_update_level', + str(0), location="system") return False # def stash_binhost(self, binhost_url): diff --git a/pym/update/utils/cl_update.py b/pym/update/utils/cl_update.py index 451cbde..6ae767b 100644 --- a/pym/update/utils/cl_update.py +++ b/pym/update/utils/cl_update.py @@ -455,6 +455,7 @@ class ClUpdateAction(Action): 'method': 'Update.update_increment_current_level()', 'depend': Tasks.success(), 'condition': lambda Get: Get('cl_update_sync_only_set') == 'off' and + Get('cl_update_pretend_set') == 'off' and Get('update.cl_update_use_migration_host') == 'on' }, # сообщение удачного завершения при обновлении ревизии