return '"{}"'.format(val)
+def _validate_squash(squash: str) -> None:
+ valid_squash_ls = [
+ "root", "root_squash", "rootsquash", "rootid", "root_id_squash",
+ "rootidsquash", "all", "all_squash", "allsquash", "all_anomnymous",
+ "allanonymous", "no_root_squash", "none", "noidsquash",
+ ]
+ if squash.lower() not in valid_squash_ls:
+ raise NFSInvalidOperation(
+ f"squash {squash} not in valid list {valid_squash_ls}"
+ )
+
+
class RawBlock():
def __init__(self, block_name: str, blocks: List['RawBlock'] = [], values: Dict[str, Any] = {}):
if not values: # workaround mutable default argument
f'{valid_access_types}'
)
- @staticmethod
- def validate_squash(squash: str) -> None:
- valid_squash_ls = [
- "root", "root_squash", "rootsquash", "rootid", "root_id_squash",
- "rootidsquash", "all", "all_squash", "allsquash", "all_anomnymous",
- "allanonymous", "no_root_squash", "none", "noidsquash",
- ]
- if squash.lower() not in valid_squash_ls:
- raise NFSInvalidOperation(
- f"squash {squash} not in valid list {valid_squash_ls}"
- )
-
def validate(self, mgr: 'Module') -> None:
if not isabs(self.pseudo) or self.pseudo == "/":
raise NFSInvalidOperation(
"path and it cannot be just '/'."
)
- self.validate_squash(self.squash)
+ _validate_squash(self.squash)
self.validate_access_type(self.access_type)
if not isinstance(self.security_label, bool):
for client in self.clients:
if client.squash:
- self.validate_squash(client.squash)
+ _validate_squash(client.squash)
if client.access_type:
self.validate_access_type(client.access_type)