Return value from validation

This commit is contained in:
Nico Schottelius 2020-12-20 22:03:43 +01:00
parent ece2bca831
commit 858aabb5ba
3 changed files with 1 additions and 8 deletions

View file

@ -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)
# )

View file

@ -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()

View file

@ -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)