From 858aabb5ba9c9e0e1fa64181839942824de0f717 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 20 Dec 2020 22:03:43 +0100 Subject: [PATCH] Return value from validation --- uncloud_net/serializers.py | 6 +----- uncloud_net/services.py | 2 -- uncloud_net/tasks.py | 1 - 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/uncloud_net/serializers.py b/uncloud_net/serializers.py index 8287047..fc87c71 100644 --- a/uncloud_net/serializers.py +++ b/uncloud_net/serializers.py @@ -32,6 +32,7 @@ class WireGuardVPNSerializer(serializers.ModelSerializer): if not value in sizes: raise serializers.ValidationError(msg) + return value def validate_wireguard_public_key(self, value): msg = _("Supplied key is not a valid wireguard public key") @@ -54,9 +55,4 @@ class WireGuardVPNSerializer(serializers.ModelSerializer): class WireGuardVPNSizesSerializer(serializers.Serializer): - size = serializers.IntegerField(min_value=0, max_value=128) - - # sizes = serializers.ListField( - # child=serializers.IntegerField(min_value=0, max_value=128) - # ) diff --git a/uncloud_net/services.py b/uncloud_net/services.py index a23d48f..4f80c44 100644 --- a/uncloud_net/services.py +++ b/uncloud_net/services.py @@ -7,8 +7,6 @@ from .tasks import * @transaction.atomic def create_wireguard_vpn(owner, public_key, network_mask): - - pool = get_suitable_pools(network_mask)[0] count = pool.wireguardvpn_set.count() diff --git a/uncloud_net/tasks.py b/uncloud_net/tasks.py index 28b90c7..78ae80c 100644 --- a/uncloud_net/tasks.py +++ b/uncloud_net/tasks.py @@ -47,7 +47,6 @@ def cdist_configure_wireguard_server(config, server): with open(fname, "w") as fd: fd.write(config) - log.debug("git committing wireguard changes") subprocess.run(f"cd {dirname} && git pull && git add {server} && git commit -m 'Updating config for {server}' && git push", shell=True, check=True)