summaryrefslogtreecommitdiff
path: root/vymgmt
diff options
context:
space:
mode:
Diffstat (limited to 'vymgmt')
-rw-r--r--vymgmt/error_distinguish.py5
-rw-r--r--vymgmt/router.py9
2 files changed, 12 insertions, 2 deletions
diff --git a/vymgmt/error_distinguish.py b/vymgmt/error_distinguish.py
index d58db2f..1f889f8 100644
--- a/vymgmt/error_distinguish.py
+++ b/vymgmt/error_distinguish.py
@@ -7,7 +7,7 @@ def distinguish_for_set(message):
:param message: A error message string from VyOS
:return: The type of error
"""
- path_error_string = ['Configuration path:', 'is not valid']
+ path_error_string = ['Configuration path:', 'is not valid', 'already exists']
value_error_string = ['Value validation failed']
all_strings = [path_error_string, value_error_string]
condition = 0
@@ -31,7 +31,8 @@ def distinguish_for_delete(message):
:return: The type of error
"""
path_error_string = ['Configuration path:', 'is not valid', 'Delete failed']
- value_error_string = ['Nothing to delete', 'the specified value does not exist']
+ value_error_string = ['Nothing to delete', 'the specified value does not exist',
+ "the specified node does not exist"]
all_strings = [path_error_string, value_error_string]
condition = 0
diff --git a/vymgmt/router.py b/vymgmt/router.py
index f46955d..15fea9e 100644
--- a/vymgmt/router.py
+++ b/vymgmt/router.py
@@ -52,6 +52,15 @@ class Router(object):
:return: A message or an error
"""
try:
+ if self.__status["commit"] == "No":
+ return "Error : You should commit and exit configure mode first."
+
+ if self.__status["save"] == "No":
+ return "Error : You should save and exit configure mode first."
+
+ if self.__status["configure"] == "Yes":
+ return "Error : You should exit configure mode first."
+
self.__conn.close()
self.__status["status"] = "logout"
self.__status["configure"] = None