MCPcopy
hub / github.com/cortexlabs/cortex / refreshCachedClusterConfig

Function refreshCachedClusterConfig

cli/cmd/cluster.go:1222–1251  ·  view source on GitHub ↗
(awsClient *awslib.Client, accessConfig *clusterconfig.AccessConfig, printToStdout bool)

Source from the content-addressed store, hash-verified

1220}
1221
1222func refreshCachedClusterConfig(awsClient *awslib.Client, accessConfig *clusterconfig.AccessConfig, printToStdout bool) clusterconfig.Config {
1223 // add empty file if cached cluster doesn't exist so that the file output by manager container maintains current user permissions
1224 cachedClusterConfigPath := getCachedClusterConfigPath(accessConfig.ClusterName, accessConfig.Region)
1225 containerConfigPath := fmt.Sprintf("/out/%s", filepath.Base(cachedClusterConfigPath))
1226
1227 copyFromPaths := []dockerCopyFromPath{
1228 {
1229 containerPath: containerConfigPath,
1230 localDir: files.Dir(cachedClusterConfigPath),
1231 },
1232 }
1233
1234 if printToStdout {
1235 fmt.Print("syncing cluster configuration ...\n\n")
1236 }
1237 out, exitCode, err := runManagerAccessCommand("/root/refresh.sh "+containerConfigPath, *accessConfig, awsClient, nil, copyFromPaths)
1238 if err != nil {
1239 exit.Error(err)
1240 }
1241 if exitCode == nil || *exitCode != 0 {
1242 exit.Error(ErrorClusterRefresh(out))
1243 }
1244
1245 refreshedClusterConfig := &clusterconfig.Config{}
1246 err = readCachedClusterConfigFile(refreshedClusterConfig, cachedClusterConfigPath)
1247 if err != nil {
1248 exit.Error(err)
1249 }
1250 return *refreshedClusterConfig
1251}
1252
1253func createS3BucketIfNotFound(awsClient *awslib.Client, bucket string, tags map[string]string) error {
1254 bucketFound, err := awsClient.DoesBucketExist(bucket)

Callers 3

cluster.goFile · 0.85
cmdPrintConfigFunction · 0.85
cmdInfoFunction · 0.85

Calls 7

DirFunction · 0.92
ErrorFunction · 0.92
runManagerAccessCommandFunction · 0.85
ErrorClusterRefreshFunction · 0.85
PrintMethod · 0.45

Tested by

no test coverage detected