... | ... |
@@ -60,7 +60,7 @@ func NewCommandValidateMasterConfig(name, fullName string, out io.Writer) *cobra |
60 | 60 |
os.Exit(1) |
61 | 61 |
} |
62 | 62 |
|
63 |
- fmt.Fprintf(options.Out, "SUCCESS: Validation succeded for file: %s\n", options.MasterConfigFile) |
|
63 |
+ fmt.Fprintf(options.Out, "SUCCESS: Validation succeeded for file: %s\n", options.MasterConfigFile) |
|
64 | 64 |
}, |
65 | 65 |
} |
66 | 66 |
|
... | ... |
@@ -42,8 +42,20 @@ func (d MasterConfigCheck) Check() types.DiagnosticResult { |
42 | 42 |
|
43 | 43 |
r.Info("DH0003", fmt.Sprintf("Found a master config file: %[1]s", d.MasterConfigFile)) |
44 | 44 |
|
45 |
- for _, err := range configvalidation.ValidateMasterConfig(masterConfig).Errors { |
|
46 |
- r.Error("DH0004", err, fmt.Sprintf("Validation of master config file '%s' failed:\n(%T) %[2]v", d.MasterConfigFile, err)) |
|
45 |
+ results := configvalidation.ValidateMasterConfig(masterConfig) |
|
46 |
+ if len(results.Errors) > 0 { |
|
47 |
+ errText := fmt.Sprintf("Validation of master config file '%s' failed:\n", d.MasterConfigFile) |
|
48 |
+ for _, err := range results.Errors { |
|
49 |
+ errText += fmt.Sprintf("%v\n", err) |
|
50 |
+ } |
|
51 |
+ r.Error("DH0004", nil, errText) |
|
52 |
+ } |
|
53 |
+ if len(results.Warnings) > 0 { |
|
54 |
+ warnText := fmt.Sprintf("Validation of master config file '%s' warned:\n", d.MasterConfigFile) |
|
55 |
+ for _, warn := range results.Warnings { |
|
56 |
+ warnText += fmt.Sprintf("%v\n", warn) |
|
57 |
+ } |
|
58 |
+ r.Warn("DH0005", nil, warnText) |
|
47 | 59 |
} |
48 | 60 |
return r |
49 | 61 |
} |
... | ... |
@@ -42,11 +42,19 @@ func (d NodeConfigCheck) Check() types.DiagnosticResult { |
42 | 42 |
r.Info("DH1003", fmt.Sprintf("Found a node config file: %[1]s", d.NodeConfigFile)) |
43 | 43 |
|
44 | 44 |
results := configvalidation.ValidateNodeConfig(nodeConfig) |
45 |
- for _, err := range results.Errors { |
|
46 |
- r.Error("DH1004", err, fmt.Sprintf("Validation of node config file '%s' failed:\n(%T) %[2]v", d.NodeConfigFile, err)) |
|
45 |
+ if len(results.Errors) > 0 { |
|
46 |
+ errText := fmt.Sprintf("Validation of node config file '%s' failed:\n", d.NodeConfigFile) |
|
47 |
+ for _, err := range results.Errors { |
|
48 |
+ errText += fmt.Sprintf("%v\n", err) |
|
49 |
+ } |
|
50 |
+ r.Error("DH1004", nil, errText) |
|
47 | 51 |
} |
48 |
- for _, err := range results.Warnings { |
|
49 |
- r.Warn("DH1005", err, fmt.Sprintf("Validation of node config file '%s' warning:\n(%T) %[2]v", d.NodeConfigFile, err)) |
|
52 |
+ if len(results.Warnings) > 0 { |
|
53 |
+ warnText := fmt.Sprintf("Validation of node config file '%s' warned:\n", d.NodeConfigFile) |
|
54 |
+ for _, warn := range results.Warnings { |
|
55 |
+ warnText += fmt.Sprintf("%v\n", warn) |
|
56 |
+ } |
|
57 |
+ r.Warn("DH1005", nil, warnText) |
|
50 | 58 |
} |
51 | 59 |
return r |
52 | 60 |
} |