MCPcopy Create free account
hub / github.com/cloudbase/garm / Validate

Method Validate

config/external.go:81–103  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

79}
80
81func (e *External) Validate() error {
82 if e.ConfigFile != "" {
83 if !filepath.IsAbs(e.ConfigFile) {
84 return fmt.Errorf("path to config file must be an absolute path")
85 }
86 if _, err := os.Stat(e.ConfigFile); err != nil {
87 return fmt.Errorf("failed to access config file %s", e.ConfigFile)
88 }
89 }
90
91 execPath, err := e.ExecutablePath()
92 if err != nil {
93 return fmt.Errorf("failed to get executable path: %w", err)
94 }
95 if _, err := os.Stat(execPath); err != nil {
96 return fmt.Errorf("failed to access external provider binary %s", execPath)
97 }
98 if !exec.IsExecutable(execPath) {
99 return fmt.Errorf("external provider binary %s is not executable", execPath)
100 }
101
102 return nil
103}

Callers

nothing calls this directly

Calls 1

ExecutablePathMethod · 0.95

Tested by

no test coverage detected