Fixes issue when exporting IOS router configs.

This commit is contained in:
Jeremy 2015-03-25 14:58:04 -06:00
parent ec6a761e04
commit 879ed9e4e6

View File

@ -357,12 +357,16 @@ class DynamipsVMHandler:
project_id=request.match_info["project_id"])
startup_config, private_config = yield from vm.extract_config()
startup_config_content = base64.decodebytes(startup_config.encode("utf-8")).decode("utf-8")
private_config_content = base64.decodebytes(private_config.encode("utf-8")).decode("utf-8")
result = {}
if startup_config:
startup_config_content = base64.decodebytes(startup_config.encode("utf-8")).decode("utf-8")
result["startup_config_content"] = startup_config_content
if private_config:
private_config_content = base64.decodebytes(private_config.encode("utf-8")).decode("utf-8")
result["private_config_content"] = private_config_content
response.set_status(200)
response.json({"startup_config_content": startup_config_content,
"private_config_content": private_config_content})
response.json(result)
@Route.post(
r"/projects/{project_id}/dynamips/vms/{vm_id}/configs/save",