mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-08 21:18:00 +03:00
Added new fields to udsactor registration and better config values check on udstunnel
This commit is contained in:
parent
62540b2773
commit
3898cf7253
@ -211,8 +211,7 @@ class Register(ActorV3Action):
|
||||
- run_once_command: comand to run just once after the actor is started. The actor will stop after this.
|
||||
The command is responsible to restart the actor.
|
||||
- log_level: log level for the actor
|
||||
- certificate: server certificate used to connect to the actor [optional, only for some kind of actors like LinuxApps]
|
||||
- comms_url: url to connect to the actor [optional, only for some kind of actors like LinuxApps]
|
||||
- custom: Custom actor data (i.e. cetificate and comms_url for LinxApps, maybe other for other services)
|
||||
|
||||
"""
|
||||
|
||||
@ -235,10 +234,8 @@ class Register(ActorV3Action):
|
||||
actorToken.post_command = self._params['post_command']
|
||||
actorToken.runonce_command = self._params['run_once_command']
|
||||
actorToken.log_level = self._params['log_level']
|
||||
if 'certificate' in self._params:
|
||||
actorToken.certificate = self._params['certificate']
|
||||
if 'comms_url' in self._params:
|
||||
actorToken.comms_url = self._params['comms_url']
|
||||
if 'custom' in self._params:
|
||||
actorToken.custom = self._params['certificate']
|
||||
actorToken.stamp = getSqlDatetime()
|
||||
actorToken.save()
|
||||
logger.info('Registered actor %s', self._params)
|
||||
@ -257,10 +254,8 @@ class Register(ActorV3Action):
|
||||
'token': secrets.token_urlsafe(36),
|
||||
'stamp': getSqlDatetime(),
|
||||
}
|
||||
if 'certificate' in self._params:
|
||||
kwargs['certificate'] = self._params['certificate']
|
||||
if 'comms_url' in self._params:
|
||||
kwargs['comms_url'] = self._params['comms_url']
|
||||
if 'custom' in self._params:
|
||||
kwargs['custom'] = self._params['custom']
|
||||
|
||||
actorToken = ActorToken.objects.create(**kwargs)
|
||||
return ActorV3Action.actorResult(actorToken.token)
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Generated by Django 4.2 on 2023-05-10 22:19
|
||||
# Generated by Django 4.2.1 on 2023-05-10 22:35
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
@ -11,14 +11,9 @@ class Migration(migrations.Migration):
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="actortoken",
|
||||
name="certificate",
|
||||
name="custom",
|
||||
field=models.TextField(blank=True, default=""),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="actortoken",
|
||||
name="comms_url",
|
||||
field=models.CharField(blank=True, default="", max_length=255),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="log",
|
||||
name="name",
|
@ -53,9 +53,8 @@ class ActorToken(models.Model):
|
||||
token = models.CharField(max_length=48, db_index=True, unique=True)
|
||||
stamp = models.DateTimeField() # Date creation or validation of this entry
|
||||
|
||||
# New fields for 4.0, optional certificate and comms_url
|
||||
certificate = models.TextField(blank=True, default='')
|
||||
comms_url = models.CharField(max_length=255, blank=True, default='')
|
||||
# New fields for 4.0, optional "custom" data, to be interpreted by specific code (i.e. AppLinux services)
|
||||
custom = models.TextField(blank=True, default='')
|
||||
|
||||
class Meta: # pylint: disable=too-few-public-methods
|
||||
app_label = 'uds'
|
||||
|
Loading…
Reference in New Issue
Block a user