Skip to content

Commit a4fa191

Browse files
committed
refactor(job): Extract mount options validation to helper function
1 parent a831d3a commit a4fa191

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

cmd/job/submit.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,8 @@ and JobSet/Kueue specific configurations like workload name, queue, nodes, and r
125125

126126
priorityClassName = strings.ToLower(priorityClassName)
127127

128-
if mountOptions != "" {
129-
for _, m := range volumeStr {
130-
if !strings.HasPrefix(m, "gs://") {
131-
return fmt.Errorf("--mount-options is currently only supported for GCS fuse volumes (gs://...)")
132-
}
133-
}
128+
if err := validateMountOptions(); err != nil {
129+
return err
134130
}
135131

136132
return nil
@@ -390,6 +386,17 @@ func validateGKENAPFlags() error {
390386
return nil
391387
}
392388

389+
func validateMountOptions() error {
390+
if mountOptions != "" {
391+
for _, m := range volumeStr {
392+
if !strings.HasPrefix(m, "gs://") {
393+
return fmt.Errorf("--mount-options is currently only supported for GCS fuse volumes (gs://...)")
394+
}
395+
}
396+
}
397+
return nil
398+
}
399+
393400
func ensureDryRunDir(path string) error {
394401
if len(path) > 0 && os.IsPathSeparator(path[len(path)-1]) {
395402
return fmt.Errorf("the dry-run-out path %q must be a file path, not a directory path", path)

0 commit comments

Comments
 (0)