Skip to content

Commit

Permalink
fix: fix explain-config cmd (#532)
Browse files Browse the repository at this point in the history
  • Loading branch information
yipeng1030 authored Jan 8, 2025
1 parent 77d59e5 commit 7897da4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/cmd/cluster/config_observer.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ func (r *configObserverOptions) printExplainConfigure(configSpecs configSpecsTyp
return nil
}

if tpl.ConfigConstraint == nil {
fmt.Printf("\n%s\n", fmt.Sprintf(noConfigConstraintPrompt, printer.BoldYellow(tplName)))
return nil
}

confSpec := tpl.ConfigConstraint.Spec
if confSpec.ParametersSchema == nil {
fmt.Printf("\n%s\n", fmt.Sprintf(notConfigSchemaPrompt, printer.BoldYellow(tplName)))
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/cluster/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ var (
notFoundConfigFileErrorMessage = "cannot find config file[name=%s] in the configspec[name=%s], all configfiles: %v"
notSupportFileUpdateErrorMessage = "not supported file[%s] for updating, current supported files: %v"

noConfigConstraintPrompt = "cannot find configConstraint for template[%s]"
notConfigSchemaPrompt = "The config template[%s] is not defined in schema and parameter explanation info cannot be generated."
cue2openAPISchemaFailedPrompt = "The cue schema may not satisfy the conversion constraints of openAPISchema and parameter explanation info cannot be generated."
restartConfirmPrompt = "The parameter change incurs a cluster restart, which brings the cluster down for a while. Enter to continue...\n, "
Expand Down

0 comments on commit 7897da4

Please sign in to comment.