-
Notifications
You must be signed in to change notification settings - Fork 90
/
config.go
28 lines (24 loc) · 905 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package print
import (
"fmt"
"strings"
configtypes "github.com/replicatedhq/kots/pkg/kotsadmconfig/types"
"github.com/replicatedhq/kots/pkg/logger"
)
func ConfigValidationErrors(log *logger.CLILogger, groupValidationErrors []configtypes.ConfigGroupValidationError) {
var sb strings.Builder
fmt.Fprintf(&sb, "Following config items have validation errors:\n\n")
for _, groupValidationError := range groupValidationErrors {
fmt.Fprintf(&sb, "Group: %s\n", groupValidationError.Name)
fmt.Fprintf(&sb, " Items:\n")
for _, itemValidationError := range groupValidationError.ItemErrors {
fmt.Fprintf(&sb, " Name: %s\n", itemValidationError.Name)
fmt.Fprintf(&sb, " Errors:\n")
for _, validationError := range itemValidationError.ValidationErrors {
fmt.Fprintf(&sb, " - %s\n", validationError.Message)
}
}
}
log.FinishSpinnerWithError()
log.Errorf(sb.String())
}