From 489ec1a7a547fa9e6148595c15abe305c415cc3e Mon Sep 17 00:00:00 2001 From: idziubenko Date: Wed, 17 Nov 2021 09:54:01 +0300 Subject: [PATCH] fixed cl-builder-update crash when host machine doesn't have a chosen binhost --- pym/update/update.py | 6 ++++-- pym/update/utils/cl_update.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pym/update/update.py b/pym/update/update.py index c15e87e..88cade2 100644 --- a/pym/update/update.py +++ b/pym/update/update.py @@ -1694,7 +1694,7 @@ class Update(MethodsInterface): return f"{host}level{level_required}" @variable_module("update") - def detect_best_binhost(self): + def detect_best_binhost(self, cl_check_update_level): # выполняется переход с серверов unstable обновлении на stable # в этом случае не важно, что бинари могут старее текущих if (self.clVars.GetBool('cl_update_binhost_stable_opt_set') and @@ -1702,7 +1702,9 @@ class Update(MethodsInterface): stabilization = True else: stabilization = False - ignore_level = self.clVars.Get("cl_check_update_level") == Variable.Off + #had to extract ignore level logic to cl_update because of variable module + ignore_level = not cl_check_update_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")) retval = self._search_best_binhost(self.binhosts_data, diff --git a/pym/update/utils/cl_update.py b/pym/update/utils/cl_update.py index 6ae767b..d49985f 100644 --- a/pym/update/utils/cl_update.py +++ b/pym/update/utils/cl_update.py @@ -73,7 +73,7 @@ def get_synchronization_tasks(object_name): 'tasks': [ # найти лучший сервер обновлений {'name': 'detect_best_binhost', - 'method': Object('detect_best_binhost()'), + 'method': Object(f'detect_best_binhost({object_name.lower()}.cl_check_update_level)'), 'essential': False, 'depend': (Tasks.success() & ~AllTasks.has_any("not_use_search") & (~AllTasks.success_one_of("check_current_binhost") | @@ -123,7 +123,7 @@ def get_synchronization_tasks(object_name): {'name': 'sync_reps:update_packages_cache', 'message': __("Update packages index"), 'method': Object('download_packages(update.cl_update_portage_binhost,' - 'update.cl_update_package_cache,update.cl_update_package_cache_sign,' + 'update.cl_update_package_cache, update.cl_update_package_cache_sign,' 'update.cl_update_gpg)'), 'essential': False, 'condition': lambda Get, GetBool: (