summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhochikong <1097225749@qq.com>2016-07-31 14:08:52 +0800
committerhochikong <1097225749@qq.com>2016-07-31 14:08:52 +0800
commit314750af29226259aceb27dfa39e1ef7aee67563 (patch)
tree10de61d3700a4fcc27cd05f043e6dea00aa27f8b
parentcf04bae19e80a39a62644d1b96f5f58302242280 (diff)
downloadpython-vyos-mgmt-314750af29226259aceb27dfa39e1ef7aee67563.tar.gz
python-vyos-mgmt-314750af29226259aceb27dfa39e1ef7aee67563.zip
T86 Python management library methods give timeouts
Fix a error in exit_config():When a user login and enter configure mode but change nothing and exit.It return a message "You should commit first!" Fix the problem when you logout you should create a new instance.Now you can reuse the BasicRouter instance
-rw-r--r--vyroute/Router.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/vyroute/Router.py b/vyroute/Router.py
index 86f3c78..476414a 100644
--- a/vyroute/Router.py
+++ b/vyroute/Router.py
@@ -113,6 +113,7 @@ class BasicRouter(Router):
self.__conn.close()
self.__status["status"] = "logout"
self.__status["configure"] = None
+ self.__conn = pxssh()
return {"Result": "Logout successfully."}
except Exception as e:
return {"Error": e}
@@ -215,6 +216,10 @@ class BasicRouter(Router):
return {"Result": "Exit configure mode successfully."}
else:
return {"Error": "You should save first."}
+ elif self.__status["commit"] is None:
+ self.__conn.sendline("exit")
+ self.__conn.prompt()
+ return {"Result": "Exit configure mode successfully."}
else:
return {"Error": "You should commit first."}
else: