mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 11:18:11 +00:00
Fixes IOU and VPCS renaming issues.
This commit is contained in:
parent
329891fc83
commit
9ac5b86431
@ -196,18 +196,6 @@ class IOUDevice(object):
|
|||||||
:param new_name: name
|
:param new_name: name
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if self._started:
|
|
||||||
raise IOUError("Cannot change the name to {} while the device is running".format(new_name))
|
|
||||||
|
|
||||||
new_working_dir = os.path.join(os.path.dirname(self._working_dir), new_name)
|
|
||||||
try:
|
|
||||||
shutil.move(self._working_dir, new_working_dir)
|
|
||||||
self._working_dir = new_working_dir
|
|
||||||
except OSError as e:
|
|
||||||
raise IOUError("Could not move working directory from {} to {}: {}".format(self._working_dir,
|
|
||||||
new_working_dir,
|
|
||||||
e))
|
|
||||||
|
|
||||||
if self._initial_config:
|
if self._initial_config:
|
||||||
# update the initial-config
|
# update the initial-config
|
||||||
config_path = os.path.join(self._working_dir, "initial-config.cfg")
|
config_path = os.path.join(self._working_dir, "initial-config.cfg")
|
||||||
|
@ -177,18 +177,6 @@ class VPCSDevice(object):
|
|||||||
:param new_name: name
|
:param new_name: name
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if self._started:
|
|
||||||
raise VPCSError("Cannot change the name to {} while the device is running".format(new_name))
|
|
||||||
|
|
||||||
new_working_dir = os.path.join(os.path.dirname(self._working_dir), new_name)
|
|
||||||
try:
|
|
||||||
shutil.move(self._working_dir, new_working_dir)
|
|
||||||
self._working_dir = new_working_dir
|
|
||||||
except OSError as e:
|
|
||||||
raise VPCSError("Could not move working directory from {} to {}: {}".format(self._working_dir,
|
|
||||||
new_working_dir,
|
|
||||||
e))
|
|
||||||
|
|
||||||
if self._script_file:
|
if self._script_file:
|
||||||
# update the startup.vpc
|
# update the startup.vpc
|
||||||
config_path = os.path.join(self._working_dir, "startup.vpc")
|
config_path = os.path.join(self._working_dir, "startup.vpc")
|
||||||
|
Loading…
Reference in New Issue
Block a user