Skip to content

Commit

Permalink
Merge pull request #55 from Onemind-Services-LLC/dev
Browse files Browse the repository at this point in the history
Release v0.3.3
  • Loading branch information
abhi1693 authored Sep 2, 2024
2 parents b986abd + d1bfa25 commit 8e56bda
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
5 changes: 3 additions & 2 deletions netbox_paas/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from extras.constants import DEFAULT_DASHBOARD
from utilities.forms import BOOLEAN_WITH_BLANK_CHOICES
from .nb_settings import *
from .validators import validate_comma_separated

JELASTIC_API = "https://app.xapp.cloudmydc.com"
NETBOX_JPS_REPO = "https://raw.githubusercontent.com/Onemind-Services-LLC/netbox-jps/master"
Expand Down Expand Up @@ -33,8 +34,8 @@
label="Allowed Hosts",
help_text="Comma separated list of allowed hosts (FQDN, IP address, or pattern), or '*' for all",
placeholder="netbox.example.com, localhost, *",
field=SimpleArrayField,
field_kwargs={'base_field': forms.CharField()},
field=forms.CharField,
field_kwargs={"validators": [validate_comma_separated]},
),
Param(
key="DB_CONN_MAX_AGE",
Expand Down
13 changes: 13 additions & 0 deletions netbox_paas/validators.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from django.core.exceptions import ValidationError

__all__ = ('validate_comma_separated',)


def validate_comma_separated(value):
if not isinstance(value, str):
raise ValidationError("This field requires a string of comma-separated values.")
values = value.split(',')
if any(not item.strip() for item in values):
raise ValidationError("Each value should be non-empty and comma-separated without extra spaces.")

return value
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="netbox-paas",
version="0.3.2",
version="0.3.3",
description="Enhances NetBox on CloudMyDC's PaaS with advanced management and control features.",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 8e56bda

Please sign in to comment.