| 377 | } |
| 378 | |
| 379 | func (n *NFSClientSetup) mountNFSDir(serverExport, mountPoint string) error { |
| 380 | output, err := cmd.NewExecutor("", "mount", "-t", "nfs", serverExport, mountPoint).ExecuteOutput() |
| 381 | if err != nil { |
| 382 | output = strings.TrimSpace(output) |
| 383 | if output != "" { |
| 384 | return fmt.Errorf("failed to mount %q from %q -> %s -> %w", mountPoint, serverExport, output, err) |
| 385 | } |
| 386 | return fmt.Errorf("failed to mount %q from %q -> %w", mountPoint, serverExport, err) |
| 387 | } |
| 388 | |
| 389 | color.PrintHint("✔ mount nfs dir %q on %q", serverExport, mountPoint) |
| 390 | return nil |
| 391 | } |
| 392 | |
| 393 | // probeNFSServer checks the NFS server's reachability before the mount call. |
| 394 | func (n *NFSClientSetup) probeNFSServer(serverExport string) error { |