mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Fix appliance properties lost when you create two node from template
This commit is contained in:
4 files changed
+22
-5
No files matched your search
@@ -15,6 +15,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import copy
|
||||
import uuid
|
||||
|
||||
|
||||
@@ -54,7 +55,7 @@ class Appliance:
|
||||
|
||||
@property
|
||||
def data(self):
|
||||
return self._data
|
||||
return copy.deepcopy(self._data)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import copy
|
||||
import uuid
|
||||
|
||||
|
||||
@@ -43,4 +44,4 @@ class ApplianceTemplate:
|
||||
"""
|
||||
Appliance data (a hash)
|
||||
"""
|
||||
return self._data
|
||||
return copy.deepcopy(self._data)
|
||||
@@ -325,11 +325,12 @@ class Project:
|
||||
Create a node from an appliance
|
||||
"""
|
||||
try:
|
||||
template = copy.copy(self.controller.appliances[appliance_id].data)
|
||||
template = self.controller.appliances[appliance_id].data
|
||||
except KeyError:
|
||||
msg = "Appliance {} doesn't exist".format(appliance_id)
|
||||
log.error(msg)
|
||||
raise aiohttp.web.HTTPNotFound(text=msg)
|
||||
print(template)
|
||||
template["x"] = x
|
||||
template["y"] = y
|
||||
node_type = template.pop("node_type")
|
||||
|
||||
Reference in new issue
Block a user