summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-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)