def __get_available_public_ports(self, expr_id, host_server, host_ports): self.log.debug("starting to get azure ports") ep = EndpointService(AzureAdapter(self.load_azure_key_id(expr_id))) host_server_name = host_server.vm_name host_server_dns = host_server.public_dns.split('.')[0] public_endpoints = ep.assign_public_endpoints(host_server_dns, 'Production', host_server_name, host_ports) if not isinstance(public_endpoints, list): self.log.debug("failed to get public ports") return internal_server_error('cannot get public ports') self.log.debug("public ports : %s" % public_endpoints) return public_endpoints
def __release_public_ports(self, expr_id, host_server, host_ports): ep = EndpointService(AzureAdapter(self.load_azure_key_id(expr_id))) host_server_name = host_server.vm_name host_server_dns = host_server.public_dns.split('.')[0] self.log.debug("starting to release ports ... ") ep.release_public_endpoints(host_server_dns, 'Production', host_server_name, host_ports)