From e9a2c4b96edc52ea114451ece6884845ad18ba6f Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 18 Apr 2020 17:56:19 +0200 Subject: ipoe-server: T2324: remove boilerplate code and adjust to other accel implementations --- python/vyos/util.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'python') diff --git a/python/vyos/util.py b/python/vyos/util.py index eb78c4a26..c70bff091 100644 --- a/python/vyos/util.py +++ b/python/vyos/util.py @@ -447,3 +447,9 @@ def is_bridge_member(interface): return False, None +def get_half_cpus(): + """ return 1/2 of the numbers of available CPUs """ + cpu = os.cpu_count() + if cpu > 1: + cpu /= 2 + return int(cpu) -- cgit v1.2.3 From b6e5515aeb4d9781e0cb3508f1d07b84b1ad0ac8 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 18 Apr 2020 21:13:46 +0200 Subject: vyos.configtree: bugfix exception message used non existent variable --- python/vyos/configtree.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'python') diff --git a/python/vyos/configtree.py b/python/vyos/configtree.py index a0b0eb3c1..d8ffaca99 100644 --- a/python/vyos/configtree.py +++ b/python/vyos/configtree.py @@ -10,7 +10,7 @@ # See the GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License along with this library; -# if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import re import json @@ -200,7 +200,7 @@ class ConfigTree(object): raise ConfigTreeError() res = self.__rename(self.__config, path_str, newname_str) if (res != 0): - raise ConfigTreeError("Path [{}] doesn't exist".format(oldpath)) + raise ConfigTreeError("Path [{}] doesn't exist".format(path)) def copy(self, old_path, new_path): check_path(old_path) @@ -213,7 +213,7 @@ class ConfigTree(object): raise ConfigTreeError() res = self.__copy(self.__config, oldpath_str, newpath_str) if (res != 0): - raise ConfigTreeError("Path [{}] doesn't exist".format(oldpath)) + raise ConfigTreeError("Path [{}] doesn't exist".format(old_path)) def exists(self, path): check_path(path) -- cgit v1.2.3