Skip to content

Commit

Permalink
Remove commented out code
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrimesix committed Jan 15, 2025
1 parent aaa0938 commit 0de11a0
Showing 1 changed file with 0 additions and 58 deletions.
58 changes: 0 additions & 58 deletions src/middlewared/middlewared/api/v25_04_0/nfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,6 @@ class NfsEntry(BaseModel):
rdma: bool
""" Enable or disable NFS over RDMA. Requires RDMA capable NIC. """

# @field_validator('bindip')
# @classmethod
# def check_bind_ip(cls, field_value: list):
# """ Custom validator for IP addresses to avoid JSON serialization errors """
# not_valid = []
# for v in field_value:
# try:
# ip_address(v)
# except ValueError:
# not_valid.append(v)
# if not_valid:
# raise ValueError(f"The following do not appear to be valid IPv4 or IPv6 addresses: {not_valid}")
# return field_value


@single_argument_args('nfs_update')
class NfsUpdateArgs(NfsEntry, metaclass=ForUpdateMetaclass):
Expand Down Expand Up @@ -127,50 +113,6 @@ class NfsShareEntry(BaseModel):
locked: bool | None
""" Lock state of the dataset (if encrypted). """

# @field_validator('networks', 'hosts')
# @classmethod
# def check_unique(cls, field_value: list):
# """ Custom validator to confirm unique entries """
# s = set()
# not_unique = []
# for v in field_value:
# if v in s:
# not_unique.append(v)
# s.add(v)
# if not_unique:
# raise ValueError(f"Entries must be unique, the following are not: {not_unique}")
# return field_value

# @field_validator('networks')
# @classmethod
# def check_valid_network(cls, field_value: list):
# """ Custom validator for IP networks """
# not_valid = []
# for v in field_value:
# try:
# ip_network(v, strict=False)
# except ValueError:
# not_valid.append(v)
# if not_valid:
# raise ValueError(f"The following do not appear to be valid IPv4 or IPv6 networks: {not_valid}")

# # Perform the courtesy conversion to a valid network format
# field_value = [str(ip_network(fv, strict=False)) for fv in field_value]
# return field_value

# @field_validator('hosts')
# @classmethod
# def no_spaces_or_quotes(cls, field_value: list):
# """ Custom validator for host field: No spaces or quotes """
# regex = re.compile(r'.*[\s"]')
# not_valid = []
# for v in field_value:
# if v is not None and regex.match(v):
# not_valid.append(v)
# if not_valid:
# raise ValueError(f"Cannot contain spaces or quotes: {not_valid}")
# return field_value


class NfsShareCreate(NfsShareEntry):
id: Excluded = excluded_field()
Expand Down

0 comments on commit 0de11a0

Please sign in to comment.