Skip to content

Commit a14c0e4

Browse files
committed
remove delimiter support
1 parent b6ac0d4 commit a14c0e4

15 files changed

Lines changed: 48 additions & 190 deletions

File tree

community/modules/compute/gke-nodeset/metadata.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ ghpc:
3030
vars: [network_storage]
3131
min: 1
3232
max: 1
33-
length_check: true
33+
length_check: true # Validates the list's length instead of its elements.
3434
error_message: "The 'network_storage' list must contain exactly one element."
3535
- validator: range
3636
inputs:
3737
vars: [filestore_id]
3838
min: 1
3939
max: 1
40-
length_check: true
40+
length_check: true # Validates the list's length instead of its elements.
4141
error_message: "The 'filestore_id' list must contain exactly one element."

community/modules/compute/mig/metadata.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ ghpc:
2424
inputs:
2525
vars: [versions]
2626
min: 1
27-
length_check: true
27+
length_check: true # Validates the list's length instead of its elements.
2828
error_message: "The 'versions' list must contain at least one version."

community/modules/compute/notebook/metadata.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@ spec:
2020
- storage.googleapis.com
2121
ghpc:
2222
validators:
23-
- validator: range
23+
- validator: regex
2424
inputs:
2525
vars: [mount_runner.args]
26-
min: 5
27-
max: 5
28-
length_check: true
29-
delimiter: " "
26+
pattern: "^[^ ]+( [^ ]+){4}$"
3027
error_message: "The 'mount_runner.args' field must contain exactly 5 elements."

community/modules/database/slurm-cloudsql-federation/metadata.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ ghpc:
2424
- validator: regex
2525
inputs:
2626
vars: [network_id]
27-
pattern: ^projects/[^/]+/global/networks/[^/]+$
27+
pattern: "^projects/[^/]+/global/networks/[^/]+$"
2828
error_message: "The network id must be provided in the following format: projects/<project_id>/global/networks/<network_name>."

community/modules/internal/slurm-gcp/nodeset_tpu/metadata.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@ ghpc:
1919
inputs:
2020
vars: [node_count_static]
2121
min: 0
22-
length_check: false
2322
error_message: "The 'node_count_static' value must be at least 0."
2423
- validator: range
2524
inputs:
2625
vars: [node_count_dynamic_max]
2726
min: 0
28-
length_check: false
2927
error_message: "The 'node_count_dynamic_max' value must be at least 0."

community/modules/scheduler/htcondor-access-point/metadata.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ ghpc:
2424
inputs:
2525
vars: [zones]
2626
max: 2
27-
length_check: true
27+
length_check: true # Validates the list's length instead of its elements.
2828
error_message: "The 'zones' list must contain at most 2 zones."

community/modules/scheduler/schedmd-slurm-gcp-v6-controller/metadata.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ghpc:
2525
inputs:
2626
vars: [static_ips]
2727
max: 1
28-
length_check: true
28+
length_check: true # Validates the list's length instead of its elements.
2929
error_message: "The Slurm modules supports 0 or 1 static IPs on controller instance."
3030
- validator: regex
3131
inputs:

docs/blueprint-validation.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,21 +122,20 @@ ghpc:
122122
```
123123

124124
### Range Validator
125-
The `range` validator ensures that input variables (or their computed lengths/segment counts) fall within a specified numerical minimum and/or maximum. It supports validating individual numeric values, the number of elements in a list, or the count of segments in a delimited string (when an optional delimiter is specified). The optional length_check field (defaulting to false) determines whether to validate the value itself or the count of its elements/segments.
125+
The `range` validator ensures input variables either their values or lengths fall within specified numerical minimum and/or maximum bounds. It supports validating individual numeric values, lists of numeric values, and the number of elements in a list. The optional length_check field (defaulting to false) determines whether to validate the values themselves or the length of the variable.
126126

127127
**Example definition in `metadata.yaml`:**
128128

129129
```yaml
130130
ghpc:
131-
validators:
131+
validators:
132132
- validator: range
133133
inputs:
134-
vars: [mount_runner.args]
135-
min: 5
136-
max: 5
137-
length_check: true
138-
delimiter: " "
139-
error_message: "The 'mount_runner.args' field must contain exactly 5 elements."
134+
vars: [versions]
135+
min: 1
136+
max: 8
137+
length_check: true # enables validation of the list's length rather than the individual values it contains.
138+
error_message: "The 'versions' list must contain at least one version."
140139
```
141140

142141
Unlike blueprint-level validators, these are intrinsic to the module and ensure that the module receives data in the exact format required for its internal logic to function.

modules/compute/gke-node-pool/metadata.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,13 @@ ghpc:
2525
vars: [name]
2626
pattern: "^[a-z]([-a-z0-9]{0,34}[a-z0-9])?$"
2727
error_message: "'name' must start with a lowercase letter, followed by up to 34 lowercase letters, numbers, or hyphens, and cannot end with a hyphen."
28+
- validator: range
29+
inputs:
30+
vars: [local.upgrade_settings.max_surge]
31+
min: 0
32+
error_message: "'max_surge' value must be at least 0."
33+
- validator: range
34+
inputs:
35+
vars: [local.upgrade_settings.max_unavailable]
36+
min: 0
37+
error_message: "'max_unavailable' value must be at least 0."

modules/file-system/filestore/metadata.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,14 @@ ghpc:
2424
inputs:
2525
vars: [size_gb]
2626
min: 1024
27-
length_check: false
2827
error_message: "The 'size_gb' value must be at least 1024 GiB. See https://cloud.google.com/filestore/docs/service-tiers for details."
28+
29+
- validator: regex
30+
inputs:
31+
vars: [network_id]
32+
pattern: ^projects/[^/]+/global/networks/[^/]+$
33+
error_message: "The network id must be provided in the following format: projects/<project_id>/global/networks/<network_name>."
34+
2935
- validator: allowed_enum
3036
inputs:
3137
vars: [filestore_tier]

0 commit comments

Comments
 (0)