mirror of
https://github.com/ansible/awx.git
synced 2026-04-08 11:39:22 -02:30
Add support for inbound hop nodes
This commit is contained in:
29
awx/main/models/receptor_address.py
Normal file
29
awx/main/models/receptor_address.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from django.db import models
|
||||
|
||||
|
||||
class ReceptorAddress(models.Model):
|
||||
address = models.CharField(max_length=255)
|
||||
port = models.IntegerField(null=True)
|
||||
protocol = models.CharField(max_length=10)
|
||||
websocket_path = models.CharField(max_length=255, default="", blank=True)
|
||||
is_internal = models.BooleanField(default=False)
|
||||
instance = models.ForeignKey(
|
||||
'Instance',
|
||||
related_name='receptor_addresses',
|
||||
on_delete=models.CASCADE,
|
||||
)
|
||||
|
||||
def get_full_address(self):
|
||||
scheme = ""
|
||||
path = ""
|
||||
port = ""
|
||||
if self.protocol == "ws":
|
||||
scheme = "wss://"
|
||||
|
||||
if self.protocol == "ws" and self.websocket_path:
|
||||
path = f"/{self.websocket_path}"
|
||||
|
||||
if self.port:
|
||||
port = f":{self.port}"
|
||||
|
||||
return f"{scheme}{self.address}{port}{path}"
|
||||
Reference in New Issue
Block a user