Fixes symbol for VM template gone after restart. Fixes #538.

This commit is contained in:
grossmj
2015-07-12 16:51:43 -06:00
parent e658786e88
commit 09d8212225
7 changed files with 19 additions and 14 deletions

View File

@@ -1 +1,2 @@
Jeremy Grossmann
Julien Duponchelle

View File

@@ -19,7 +19,6 @@
Dynamips module implementation.
"""
import sys
import os
import shutil
import hashlib
@@ -168,8 +167,9 @@ class Dynamips(Module):
router_settings = IOS_ROUTER_SETTINGS.copy()
router_settings.update(router)
# for backward compatibility before version 1.4
router_settings["symbol"] = router_settings.get("default_symbol", router_settings["symbol"])
router_settings["symbol"] = router_settings["symbol"][:-11] + ".svg" if router_settings["symbol"].endswith("normal.svg") else router_settings["symbol"]
if "symbol" not in router_settings:
router_settings["symbol"] = router_settings["default_symbol"]
router_settings["symbol"] = router_settings["symbol"][:-11] + ".svg" if router_settings["symbol"].endswith("normal.svg") else router_settings["symbol"]
self._ios_routers[key] = router_settings
def _saveIOSRouters(self):

View File

@@ -106,8 +106,9 @@ class IOU(Module):
device_settings = IOU_DEVICE_SETTINGS.copy()
device_settings.update(device)
# for backward compatibility before version 1.4
device_settings["symbol"] = device_settings.get("default_symbol", device_settings["symbol"])
device_settings["symbol"] = device_settings["symbol"][:-11] + ".svg" if device_settings["symbol"].endswith("normal.svg") else device_settings["symbol"]
if "symbol" not in device_settings:
device_settings["symbol"] = device_settings["default_symbol"]
device_settings["symbol"] = device_settings["symbol"][:-11] + ".svg" if device_settings["symbol"].endswith("normal.svg") else device_settings["symbol"]
device_settings["startup_config"] = device_settings.get("initial_config", device_settings["startup_config"])
self._iou_devices[key] = device_settings

View File

@@ -94,8 +94,9 @@ class Qemu(Module):
vm_settings = QEMU_VM_SETTINGS.copy()
vm_settings.update(vm)
# for backward compatibility before version 1.4
vm_settings["symbol"] = vm_settings.get("default_symbol", vm_settings["symbol"])
vm_settings["symbol"] = vm_settings["symbol"][:-11] + ".svg" if vm_settings["symbol"].endswith("normal.svg") else vm_settings["symbol"]
if "symbol" not in vm_settings:
vm_settings["symbol"] = vm_settings.get("default_symbol", vm_settings["symbol"])
vm_settings["symbol"] = vm_settings["symbol"][:-11] + ".svg" if vm_settings["symbol"].endswith("normal.svg") else vm_settings["symbol"]
self._qemu_vms[key] = vm_settings
def _saveQemuVMs(self):

View File

@@ -128,8 +128,9 @@ class VirtualBox(Module):
vm_settings = VBOX_VM_SETTINGS.copy()
vm_settings.update(vm)
# for backward compatibility before version 1.4
vm_settings["symbol"] = vm_settings.get("default_symbol", vm_settings["symbol"])
vm_settings["symbol"] = vm_settings["symbol"][:-11] + ".svg" if vm_settings["symbol"].endswith("normal.svg") else vm_settings["symbol"]
if "symbol" not in vm_settings:
vm_settings["symbol"] = vm_settings.get("default_symbol", vm_settings["symbol"])
vm_settings["symbol"] = vm_settings["symbol"][:-11] + ".svg" if vm_settings["symbol"].endswith("normal.svg") else vm_settings["symbol"]
self._virtualbox_vms[key] = vm_settings
def _saveVirtualBoxVMs(self):

View File

@@ -161,8 +161,9 @@ class VMware(Module):
vm_settings = VMWARE_VM_SETTINGS.copy()
vm_settings.update(vm)
# for backward compatibility before version 1.4
vm_settings["symbol"] = vm_settings.get("default_symbol", vm_settings["symbol"])
vm_settings["symbol"] = vm_settings["symbol"][:-11] + ".svg" if vm_settings["symbol"].endswith("normal.svg") else vm_settings["symbol"]
if "symbol" not in vm_settings:
vm_settings["symbol"] = vm_settings.get("default_symbol", vm_settings["symbol"])
vm_settings["symbol"] = vm_settings["symbol"][:-11] + ".svg" if vm_settings["symbol"].endswith("normal.svg") else vm_settings["symbol"]
self._vmware_vms[key] = vm_settings
def _saveVMwareVMs(self):

View File

@@ -1,5 +1,5 @@
[tox]
envlist = py33, py34
envlist = py34
[testenv]
sitepackages=True
@@ -12,5 +12,5 @@ ignore = E501,E402
[pytest]
addopts = -s
python_paths = {toxinidir}
norecursedirs = old_tests .tox
norecursedirs = .tox
timeout = 10