fix(clustertool): fix some talhelper-connectivity mistakes
This commit is contained in:
@@ -25,10 +25,10 @@ func LoadTalEnv(noFail bool) error {
|
||||
} else if os.IsNotExist(err) {
|
||||
// If the file doesn't exist, check noFail to determine next steps
|
||||
if noFail {
|
||||
log.Info().Msg("clusterenv.yaml file not found, but skipping due to noFail being true.")
|
||||
log.Debug().Msg("clusterenv.yaml file not found, but skipping due to noFail being true.")
|
||||
return nil // Skip execution without error
|
||||
} else {
|
||||
log.Info().Msg("clusterenv.yaml file not found, exiting as noFail is false.")
|
||||
log.Fatal().Msg("clusterenv.yaml file not found, exiting...")
|
||||
os.Exit(1) // Exit with error code 1
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -141,13 +141,29 @@ func FormatGitURL(input string) string {
|
||||
}
|
||||
|
||||
func genBaseFiles() error {
|
||||
clusterEnvPresent := false
|
||||
|
||||
if _, err := os.Stat(helper.ClusterEnvFile); err == nil {
|
||||
clusterEnvPresent = true
|
||||
log.Debug().Msg("Detected existing cluster, continuing")
|
||||
} else if os.IsNotExist(err) {
|
||||
log.Warn().Msg("New cluster detected, creating clusterenv.yaml\n Please fill out ClusterEnv.yaml and run again!")
|
||||
} else {
|
||||
log.Fatal().Err(err).Msgf("Error checking clusterenv file: %s", err)
|
||||
return err
|
||||
}
|
||||
|
||||
err := helper.CopyDir(helper.BaseCache, helper.ClusterPath+"", false)
|
||||
if err != nil {
|
||||
log.Info().Msgf("Error: %v", err)
|
||||
log.Error().Msgf("Error: %v", err)
|
||||
} else {
|
||||
log.Info().Msg("Base files copied successfully.")
|
||||
}
|
||||
|
||||
if !clusterEnvPresent {
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
log.Info().Msg("basefiles successfully altered.")
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user