RelativizeClusterLocalPaths first absolutizes the paths by calling ResolveLocalPaths. This assumes that any NEW path is already absolute, but any existing path will be resolved relative to LocationOfOrigin
(cluster *clientcmdapi.Cluster)
| 494 | // RelativizeClusterLocalPaths first absolutizes the paths by calling ResolveLocalPaths. This assumes that any NEW path is already |
| 495 | // absolute, but any existing path will be resolved relative to LocationOfOrigin |
| 496 | func RelativizeClusterLocalPaths(cluster *clientcmdapi.Cluster) error { |
| 497 | if len(cluster.LocationOfOrigin) == 0 { |
| 498 | return fmt.Errorf("no location of origin for %s", cluster.Server) |
| 499 | } |
| 500 | base, err := filepath.Abs(filepath.Dir(cluster.LocationOfOrigin)) |
| 501 | if err != nil { |
| 502 | return fmt.Errorf("could not determine the absolute path of config file %s: %v", cluster.LocationOfOrigin, err) |
| 503 | } |
| 504 | |
| 505 | if err := ResolvePaths(GetClusterFileReferences(cluster), base); err != nil { |
| 506 | return err |
| 507 | } |
| 508 | if err := RelativizePathWithNoBacksteps(GetClusterFileReferences(cluster), base); err != nil { |
| 509 | return err |
| 510 | } |
| 511 | |
| 512 | return nil |
| 513 | } |
| 514 | |
| 515 | // RelativizeAuthInfoLocalPaths first absolutizes the paths by calling ResolveLocalPaths. This assumes that any NEW path is already |
| 516 | // absolute, but any existing path will be resolved relative to LocationOfOrigin |
no test coverage detected