MCPcopy
hub / github.com/kubernetes/client-go / RelativizeAuthInfoLocalPaths

Function RelativizeAuthInfoLocalPaths

tools/clientcmd/loader.go:517–534  ·  view source on GitHub ↗

RelativizeAuthInfoLocalPaths 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

(authInfo *clientcmdapi.AuthInfo)

Source from the content-addressed store, hash-verified

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
517func RelativizeAuthInfoLocalPaths(authInfo *clientcmdapi.AuthInfo) error {
518 if len(authInfo.LocationOfOrigin) == 0 {
519 return fmt.Errorf("no location of origin for %v", authInfo)
520 }
521 base, err := filepath.Abs(filepath.Dir(authInfo.LocationOfOrigin))
522 if err != nil {
523 return fmt.Errorf("could not determine the absolute path of config file %s: %v", authInfo.LocationOfOrigin, err)
524 }
525
526 if err := ResolvePaths(GetAuthInfoFileReferences(authInfo), base); err != nil {
527 return err
528 }
529 if err := RelativizePathWithNoBacksteps(GetAuthInfoFileReferences(authInfo), base); err != nil {
530 return err
531 }
532
533 return nil
534}
535
536func RelativizeConfigPaths(config *clientcmdapi.Config, base string) error {
537 return RelativizePathWithNoBacksteps(GetConfigFileReferences(config), base)

Callers 1

ModifyConfigFunction · 0.85

Calls 4

ResolvePathsFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected