MCPcopy Index your code
hub / github.com/celer-pkg/celer / probeNFSServer

Method probeNFSServer

pkgcache/cache_setup.go:394–407  ·  view source on GitHub ↗

probeNFSServer checks the NFS server's reachability before the mount call.

(serverExport string)

Source from the content-addressed store, hash-verified

392
393// probeNFSServer checks the NFS server's reachability before the mount call.
394func (n *NFSClientSetup) probeNFSServer(serverExport string) error {
395 host, _, ok := strings.Cut(serverExport, ":")
396 if !ok || host == "" {
397 return fmt.Errorf("invalid server export %q (expected <server>:<path>)", serverExport)
398 }
399
400 // Ping to test if ip/hostname is reachable.
401 pingStart := time.Now()
402 if _, err := cmd.NewExecutor("", "ping", "-c", "1", "-W", "3", host).ExecuteOutput(); err != nil {
403 return fmt.Errorf("NFS server %q is not reachable (ping failed in %s); check the IP/hostname and the network -> %w", host, time.Since(pingStart).Truncate(time.Millisecond), err)
404 }
405
406 return nil
407}
408
409// checkServerTools verifies that all system packages needed by server setup are installed.
410func checkServerTools() error {

Callers 1

SetupMethod · 0.95

Calls 2

NewExecutorFunction · 0.92
ExecuteOutputMethod · 0.80

Tested by

no test coverage detected