if server is None:
return False
name_parts = server.name.split('_')
- if len(name_parts) < 3:
- return False
-
- for stack in self.stacks.values():
- if stack.stack_name == name_parts[1]:
- stack.servers.pop(server.id, None)
+ if len(name_parts) > 1:
+ for stack in self.stacks.values():
+ if stack.stack_name == name_parts[1]:
+ stack.servers.pop(server.id, None)
if self.computeUnits.pop(server.id, None) is None:
return False
return True
net.subnet_name = subnet_dict["subnet"].get('name', str(net.name) + '-sub')
if net.subnet_id is not None:
+ LOG.error("Only one subnet per network is supported: {}".format(net.subnet_id))
return Response('Only one subnet per network is supported\n', status=409, mimetype='application/json')
if "id" in subnet_dict["subnet"]:
for server in self.api.compute.computeUnits.values():
for port_name in server.port_names:
port = self.api.compute.find_port_by_name_or_id(port_name)
+ if port is None:
+ LOG.warning("Port search for {} returned None.".format(port_name))
+ continue
if port.net_name == net.name:
port.ip_address = None
self.api.compute.dc.net.removeLink(
name = str(self.api.compute.dc.label) + "_" + server_dict["name"]
if self.api.compute.find_server_by_name_or_id(name) is not None:
+ LOG.error("Server with name %s already exists. 409" % name)
return Response("Server with name %s already exists." % name, status=409)
# TODO: not finished!
resp = dict()