summaryrefslogtreecommitdiff
path: root/python/vyos
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-04-18 21:36:04 +0200
committerChristian Poessinger <christian@poessinger.com>2020-04-18 21:36:04 +0200
commit0ffdf24983507bb8140e6d30343993059abfc4dd (patch)
tree53b21eb45fde4621f49a54286db1f94fe4bfe05f /python/vyos
parent0988b60f813cb1659785e0e92a165052f7d67311 (diff)
parent68ebb2a39c6d98a4d2cc25b9b84e4a9594238608 (diff)
downloadvyos-1x-0ffdf24983507bb8140e6d30343993059abfc4dd.tar.gz
vyos-1x-0ffdf24983507bb8140e6d30343993059abfc4dd.zip
Merge branch 'ipoe-server' of github.com:c-po/vyos-1x into current
* 'ipoe-server' of github.com:c-po/vyos-1x: pppoe-server: T2314: fix RADIUS migration vyos.configtree: bugfix exception message used non existent variable ipoe-server: T2324: migrate RADIUS configuration to common CLI syntax ipoe-server: T2324: migrate IPv4/IPv6 name-servers to common node ipoe-server: T2324: remove boilerplate code and adjust to other accel implementations router-advert: rename XML/Python files for a common pattern ipoe-server: rename XML/Python files for a common pattern
Diffstat (limited to 'python/vyos')
-rw-r--r--python/vyos/configtree.py6
-rw-r--r--python/vyos/util.py6
2 files changed, 9 insertions, 3 deletions
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)
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)