Skip to content

Commit

Permalink
update to support port list
Browse files Browse the repository at this point in the history
  • Loading branch information
whitej6 committed Nov 12, 2022
1 parent 60ec541 commit d5e488b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## v1.1.2 - 2022-11-12

### Added

- #108 Enable cloning for PolicyRule and NATPolicyRule models
- #110 Add support for port lists on ServiceObject

### Fixed

- #109 Resolved incorrect links in mkdocs.yml

## v1.1.1 - 2022-10-26

### Fixed
Expand Down
23 changes: 12 additions & 11 deletions nautobot_firewall_models/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@


def validate_port(value):
"""Validates value is a port or port range."""
if value.isnumeric():
return
if re.match(r"^\d*\-\d*$", value):
return
if value is None or value == "":
return
raise ValidationError(
_("%(value)s is not a port number or port range."),
params={"value": value},
)
"""Validates value is a port, port range, or port list."""
for i in value.split(","):
if i.isnumeric():
continue
if re.match(r"^\d*\-\d*$", i):
continue
if i is None or i == "":
continue
raise ValidationError(
_("%(i)s is not a port number or port range."),
params={"value": i},
)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "nautobot-firewall-models"
version = "1.1.1"
version = "1.1.2"
description = "Nautobot plugin to model firewall objects."
authors = ["Network to Code, LLC <info@networktocode.com>"]
license = "Apache-2.0"
Expand Down

0 comments on commit d5e488b

Please sign in to comment.