MCPcopy Create free account
hub / github.com/containers/image / resolveLocalPaths

Function resolveLocalPaths

openshift/openshift-copies.go:657–686  ·  view source on GitHub ↗

resolveLocalPaths is a modified copy of k8s.io/kubernetes/pkg/client/unversioned/clientcmd.ClientConfigLoadingRules.resolveLocalPaths. ResolveLocalPaths resolves all relative paths in the config object with respect to the stanza's LocationOfOrigin this cannot be done directly inside of LoadFromFile

(config *clientcmdConfig)

Source from the content-addressed store, hash-verified

655// this cannot be done directly inside of LoadFromFile because doing so there would make it impossible to load a file without
656// modification of its contents.
657func resolveLocalPaths(config *clientcmdConfig) error {
658 for _, cluster := range config.Clusters {
659 if len(cluster.LocationOfOrigin) == 0 {
660 continue
661 }
662 base, err := filepath.Abs(filepath.Dir(cluster.LocationOfOrigin))
663 if err != nil {
664 return fmt.Errorf("Could not determine the absolute path of config file %s: %w", cluster.LocationOfOrigin, err)
665 }
666
667 if err := resolvePaths(getClusterFileReferences(cluster), base); err != nil {
668 return err
669 }
670 }
671 for _, authInfo := range config.AuthInfos {
672 if len(authInfo.LocationOfOrigin) == 0 {
673 continue
674 }
675 base, err := filepath.Abs(filepath.Dir(authInfo.LocationOfOrigin))
676 if err != nil {
677 return fmt.Errorf("Could not determine the absolute path of config file %s: %w", authInfo.LocationOfOrigin, err)
678 }
679
680 if err := resolvePaths(getAuthInfoFileReferences(authInfo), base); err != nil {
681 return err
682 }
683 }
684
685 return nil
686}
687
688// getClusterFileReferences is a modified copy of k8s.io/kubernetes/pkg/client/unversioned/clientcmd.ClientConfigLoadingRules.GetClusterFileReferences.
689func getClusterFileReferences(cluster *clientcmdCluster) []*string {

Callers 1

LoadMethod · 0.85

Calls 3

resolvePathsFunction · 0.85
getClusterFileReferencesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…