summaryrefslogtreecommitdiff
path: root/vymgmt
diff options
context:
space:
mode:
authorhochikong <1097225749@qq.com>2016-09-05 16:04:28 +0800
committerhochikong <1097225749@qq.com>2016-09-05 16:04:28 +0800
commit08de63663cde910ed746c6c976e42d2aebc56f68 (patch)
tree3dc8efe8f5b540924252079f8cb3f9b2141b8203 /vymgmt
parent8b09a0cf44a4d4b695dff70004defc01ff350fbd (diff)
downloadpython-vyos-mgmt-08de63663cde910ed746c6c976e42d2aebc56f68.tar.gz
python-vyos-mgmt-08de63663cde910ed746c6c976e42d2aebc56f68.zip
Fix a problem in exit()
Diffstat (limited to 'vymgmt')
-rw-r--r--vymgmt/router.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/vymgmt/router.py b/vymgmt/router.py
index 1a5e658..d2b35d5 100644
--- a/vymgmt/router.py
+++ b/vymgmt/router.py
@@ -73,7 +73,7 @@ class Router(object):
has_error = 'Type3'
else:
if self.__status["commit"] == "Yes":
- has_error = 'Type2'
+ has_error = 'Type3'
elif self.__status["commit"] is None:
has_error = 'Type3'
else:
@@ -85,8 +85,8 @@ class Router(object):
if has_error == 'Type1':
raise MaintenanceError("Error : You should commit and exit configure mode first.")
- if has_error == 'Type2':
- raise MaintenanceError("Error : You should save and exit configure mode first.")
+# if has_error == 'Type2':
+# raise MaintenanceError("Error : You should save and exit configure mode first.")
if has_error == 'Type3':
raise MaintenanceError("Error : You should exit configure mode first.")
if has_error == 'Type4':
@@ -225,8 +225,12 @@ class Router(object):
self.__status["configure"] = "No"
self.__status["save"] = None
self.__status["commit"] = None
- else:
- has_error = 'Type1'
+ elif self.__status["save"] == "No":
+ self.__conn.sendline("exit")
+ self.__conn.prompt()
+ self.__status["configure"] = "No"
+ self.__status["save"] = None
+ self.__status["commit"] = None
elif self.__status["commit"] is None:
self.__conn.sendline("exit")
self.__conn.prompt()
@@ -240,8 +244,6 @@ class Router(object):
except Exception as e:
return e
- if has_error == 'Type1':
- raise MaintenanceError("Error : You should save first.")
if has_error == 'Type2':
raise MaintenanceError("Error : You should commit first.")
if has_error == 'Type3':