mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-05-08 11:58:19 +00:00
Fix renaming IOL hostname replaces %h only in a single place. Fixes #1707
This commit is contained in:
parent
825dc5996d
commit
a47fa83cec
@ -1532,7 +1532,7 @@ class Router(BaseNode):
|
|||||||
try:
|
try:
|
||||||
with open(self.startup_config_path, "r+", encoding="utf-8", errors="replace") as f:
|
with open(self.startup_config_path, "r+", encoding="utf-8", errors="replace") as f:
|
||||||
old_config = f.read()
|
old_config = f.read()
|
||||||
new_config = re.sub(r"^hostname .+$", "hostname " + new_name, old_config, flags=re.MULTILINE)
|
new_config = re.sub(r"hostname .+$", "hostname " + new_name, old_config, flags=re.MULTILINE)
|
||||||
f.seek(0)
|
f.seek(0)
|
||||||
f.write(new_config)
|
f.write(new_config)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
|
@ -325,7 +325,7 @@ class IOUVM(BaseNode):
|
|||||||
|
|
||||||
if self.startup_config_file:
|
if self.startup_config_file:
|
||||||
content = self.startup_config_content
|
content = self.startup_config_content
|
||||||
content = re.sub(r"^hostname .+$", "hostname " + new_name, content, flags=re.MULTILINE)
|
content = re.sub(r"hostname .+$", "hostname " + new_name, content, flags=re.MULTILINE)
|
||||||
self.startup_config_content = content
|
self.startup_config_content = content
|
||||||
|
|
||||||
super(IOUVM, IOUVM).name.__set__(self, new_name)
|
super(IOUVM, IOUVM).name.__set__(self, new_name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user