Use "template" to name what we use to create new nodes.

This commit is contained in:
grossmj
2018-11-28 16:12:57 +07:00
parent 21c0a35f77
commit d7c2e16c21
262 changed files with 16588 additions and 16863 deletions

View File

@ -476,19 +476,19 @@ class Project:
return new_name
@open_required
async def add_node_from_appliance(self, appliance_id, x=0, y=0, compute_id=None):
async def add_node_from_template(self, template_id, x=0, y=0, compute_id=None):
"""
Create a node from an appliance
Create a node from a template.
"""
try:
template = copy.deepcopy(self.controller.appliances[appliance_id].settings)
template = copy.deepcopy(self.controller.templates[template_id].settings)
except KeyError:
msg = "Appliance {} doesn't exist".format(appliance_id)
msg = "Template {} doesn't exist".format(template_id)
log.error(msg)
raise aiohttp.web.HTTPNotFound(text=msg)
template["x"] = x
template["y"] = y
node_type = template.pop("appliance_type")
node_type = template.pop("template_type")
compute = self.controller.get_compute(template.pop("compute_id", compute_id))
name = template.pop("name")
default_name_format = template.pop("default_name_format", "{name}-{0}")