diff --git a/pym/update/update.py b/pym/update/update.py index 2d1c53c..e221ad0 100644 --- a/pym/update/update.py +++ b/pym/update/update.py @@ -1023,6 +1023,7 @@ class Update(MethodsInterface): 'cl_update_binhost_list', 'cl_update_binhost_unstable_list', 'cl_update_binhost_stable_set', + 'cl_update_binhost_stable_opt_set', 'cl_update_branch_name', 'cl_profile_system', 'cl_update_rep'): @@ -1177,11 +1178,6 @@ class Update(MethodsInterface): if hosts[0] != self.clVars.Get('update.cl_update_binhost'): self.refresh_binhost = True self.clVars.Write('cl_update_binhost', hosts[0], location="system") - if self.clVars.Get('cl_action') == 'update': - self.clVars.Write( - 'cl_update_binhost_stable_set', - self.clVars.Get('update.cl_update_binhost_stable_set'), - location="system") new_ts = self.clVars.Get("update.cl_update_binhost_timestamp") if new_ts: new_ts = new_ts[0] @@ -1190,6 +1186,14 @@ class Update(MethodsInterface): int(new_ts) > int(old_ts)): ini = SystemIni(self.clVars) ini.setVar('update', {'last_update': new_ts}) + if self.clVars.Get('cl_action') == 'sync': + value = self.clVars.GetBool('cl_update_binhost_stable_set') + new_value = self.clVars.GetBool('cl_update_binhost_stable_opt_set') + if value != new_value: + self.clVars.Write( + 'cl_update_binhost_stable_set', + self.clVars.Get('update.cl_update_binhost_stable_opt_set'), + location="system") return True def message_binhost_changed(self): diff --git a/pym/update/variables/update.py b/pym/update/variables/update.py index fadc949..56b4064 100644 --- a/pym/update/variables/update.py +++ b/pym/update/variables/update.py @@ -300,7 +300,7 @@ class VariableClUpdateBinhostData(ReadonlyTableVariable): def get(self, hr=HumanReadable.No): last_ts = self.Get('cl_update_last_timestamp') - if self.GetBool('cl_update_binhost_stable_set'): + if self.GetBool('cl_update_binhost_stable_opt_set'): binhost_list = self.Get('cl_update_binhost_list') else: binhost_list = self.Get('cl_update_binhost_unstable_list') @@ -324,10 +324,6 @@ class VariableClUpdateBinhostData(ReadonlyTableVariable): logger = self.get_logger(stub=binhosts_data.is_cache()) ret_val = None - # TODO: важно еще сверу коммент - # отладочная строка - # необходимо разобраться почему calculate-builder вызывает - # заполнение несколько раз!!!!!!!!!!!! logger.info("Started scan on: {date}, current timestamp: {ts}".format( date=time.ctime(), ts=last_ts)) for host, ts, t, good, downgrade in binhosts_data.get_sorted(): @@ -1313,6 +1309,7 @@ class DataVarsUpdateProfile(SimpleDataVars): VariableClUpdateBinhostList(section="update"), VariableClUpdateBinhostUnstableList(section="update"), VariableClUpdateBinhostStableSet(section="update"), + VariableClUpdateBinhostStableOptSet(section="update"), VariableClUpdateBinhostRevisionPath(section="update"), ) self['cl_profile_system'] = profile @@ -1320,7 +1317,7 @@ class DataVarsUpdateProfile(SimpleDataVars): if recheck is not None: self['cl_update_binhost_recheck_set'] = recheck if stable is not None: - self['cl_update_binhost_stable_set'] = stable + self['cl_update_binhost_stable_opt_set'] = stable self.flIniFileFrom(profile) def __repr__(self): @@ -1520,7 +1517,6 @@ class VariableClUpdateBinhostUnstableList(Variable): type = "list" value = ["ftp://ftp.calculate-linux.ru/testing"] - class VariableClUpdateBinhostStableSet(Variable): """ Удлять лишние файлы из репозиториев (например созданные пользователем) @@ -1528,12 +1524,22 @@ class VariableClUpdateBinhostStableSet(Variable): type = "bool" value = "on" +class VariableClUpdateBinhostStableOptSet(Variable): + """ + Удлять лишние файлы из репозиториев (например созданные пользователем) + """ + type = "bool" + value = "on" + opt = ["--stable"] def init(self): self.label = _("Check the repositories integrity") self.help = _("use only stable updates") + def get(self): + return self.Get('cl_update_binhost_stable_set') + class VariableClUpdateBinhost(Variable): """ diff --git a/pym/update/wsdl_update.py b/pym/update/wsdl_update.py index 46e74fa..2503e64 100644 --- a/pym/update/wsdl_update.py +++ b/pym/update/wsdl_update.py @@ -64,7 +64,8 @@ class Wsdl(WsdlBase): # описание груп (список лямбда функций) 'groups': [ lambda group: group(_("Update the system"), - normal=('cl_update_binhost_stable_set',), + normal=( + 'cl_update_binhost_stable_opt_set',), expert=( 'cl_update_sync_only_set', 'cl_update_other_set',