Skip to content

Commit

Permalink
fix: adapt componentDef and componentDefRef for promote command
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyelei committed Oct 12, 2024
1 parent 14f3a72 commit 378a377
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/cmd/cluster/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,11 @@ func (o *OperationsOptions) CompleteCharacterType(clusterObj *appsv1alpha1.Clust
if err := util.GetResourceObjectFromGVR(types.ClusterDefGVR(), clusterDefKey, o.Dynamic, &clusterDefObj); err != nil {
return err
}

componentDef := clusterDefObj.GetComponentDefByName(componentSpec.ComponentDefRef)
compDefName := componentSpec.ComponentDefRef
if compDefName == "" {
compDefName = componentSpec.ComponentDef
}
componentDef := clusterDefObj.GetComponentDefByName(compDefName)
if componentDef == nil {
return fmt.Errorf("failed to get component def :%s", componentSpec.ComponentDefRef)
}
Expand Down

0 comments on commit 378a377

Please sign in to comment.