From 0d856ae180498bba75ab077b15b4ecdbd7d8a8aa Mon Sep 17 00:00:00 2001 From: grossmj Date: Mon, 28 Apr 2014 10:03:03 -0600 Subject: [PATCH] Fixes #7. --- gns3server/modules/dynamips/backends/vm.py | 16 ++++++++++------ gns3server/modules/iou/__init__.py | 7 ++++--- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/gns3server/modules/dynamips/backends/vm.py b/gns3server/modules/dynamips/backends/vm.py index 3a838788..14930f2b 100644 --- a/gns3server/modules/dynamips/backends/vm.py +++ b/gns3server/modules/dynamips/backends/vm.py @@ -393,16 +393,20 @@ class VM(object): # a new startup-config has been pushed if "startup_config_base64" in request: config_filename = "{}.cfg".format(router.name) - response["startup_config"] = self.save_base64config(request["startup_config_base64"], router, config_filename) - if "startup_config" in response: - router.set_config(response["startup_config"]) + # update the request with the new local startup-config path + request["startup_config"] = self.save_base64config(request["startup_config_base64"], router, config_filename) + if "startup_config" in request: + router.set_config(request["startup_config"]) + response["startup_config"] = request["startup_config"] # a new private-config has been pushed if "private_config_base64" in request: config_filename = "{}-private.cfg".format(router.name) - response["private_config"] = self.save_base64config(request["private_config_base64"], router, config_filename) - if "private_config" in response: - router.set_config(router.startup_config, response["private_config"]) + # update the request with the new local private-config path + request["private_config"] = self.save_base64config(request["private_config_base64"], router, config_filename) + if "private_config" in request: + router.set_config(router.startup_config, request["private_config"]) + response["private_config"] = request["private_config"] except DynamipsError as e: self.send_custom_error(str(e)) diff --git a/gns3server/modules/iou/__init__.py b/gns3server/modules/iou/__init__.py index f13d7de9..bba1ee97 100644 --- a/gns3server/modules/iou/__init__.py +++ b/gns3server/modules/iou/__init__.py @@ -388,13 +388,14 @@ class IOU(IModule): f.write(config) except OSError as e: raise IOUError("Could not save the configuration {}: {}".format(config_path, e)) - response["startup_config"] = os.path.basename(config_path) - if "startup_config" in request: - iou_instance.startup_config = response["startup_config"] + # update the request with the new local startup-config path + request["startup_config"] = os.path.basename(config_path) + except IOUError as e: self.send_custom_error(str(e)) return + # update the IOU settings for name, value in request.items(): if hasattr(iou_instance, name) and getattr(iou_instance, name) != value: try: