Skip to content

Commit

Permalink
Fixes symbol for VM template gone after restart. Fixes #538.
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmj committed Jul 12, 2015
1 parent e658786 commit 09d8212
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 14 deletions.
3 changes: 2 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Jeremy Grossmann
Jeremy Grossmann
Julien Duponchelle
6 changes: 3 additions & 3 deletions gns3/modules/dynamips/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
Dynamips module implementation.
"""

import sys
import os
import shutil
import hashlib
Expand Down Expand Up @@ -168,8 +167,9 @@ def _loadIOSRouters(self):
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):
Expand Down
5 changes: 3 additions & 2 deletions gns3/modules/iou/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ def _loadIOUDevices(self):
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

Expand Down
5 changes: 3 additions & 2 deletions gns3/modules/qemu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ def _loadQemuVMs(self):
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):
Expand Down
5 changes: 3 additions & 2 deletions gns3/modules/virtualbox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,9 @@ def _loadVirtualBoxVMs(self):
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):
Expand Down
5 changes: 3 additions & 2 deletions gns3/modules/vmware/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,9 @@ def _loadVMwareVMs(self):
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):
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py33, py34
envlist = py34

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

0 comments on commit 09d8212

Please sign in to comment.