Skip to content

Commit

Permalink
fix(cluster,dm): don't pass ctx.PublicKeyPath
Browse files Browse the repository at this point in the history
  • Loading branch information
jsvisa committed Nov 23, 2020
1 parent 730c926 commit 7c7cfea
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 13 deletions.
4 changes: 2 additions & 2 deletions components/cluster/command/prune.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func destroyTombstoneIfNeed(clusterName string, metadata *spec.ClusterMeta, opt
return perrs.AddStack(err)
}

nodes, err := operator.DestroyTombstone(ctx, topo, true /* returnNodesOnly */, opt, tlsCfg, ctx.PublicKeyPath)
nodes, err := operator.DestroyTombstone(ctx, topo, true /* returnNodesOnly */, opt, tlsCfg)
if err != nil {
return perrs.AddStack(err)
}
Expand All @@ -93,7 +93,7 @@ func destroyTombstoneIfNeed(clusterName string, metadata *spec.ClusterMeta, opt

log.Infof("Start destroy Tombstone nodes: %v ...", nodes)

_, err = operator.DestroyTombstone(ctx, topo, false /* returnNodesOnly */, opt, tlsCfg, ctx.PublicKeyPath)
_, err = operator.DestroyTombstone(ctx, topo, false /* returnNodesOnly */, opt, tlsCfg)
if err != nil {
return perrs.AddStack(err)
}
Expand Down
3 changes: 1 addition & 2 deletions components/dm/command/scale_in.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func newScaleInCmd() *cobra.Command {
b.Func(
fmt.Sprintf("ScaleInCluster: options=%+v", gOpt),
func(ctx *task.Context) error {
return ScaleInDMCluster(ctx, metadata.Topology, gOpt, ctx.PublicKeyPath)
return ScaleInDMCluster(ctx, metadata.Topology, gOpt)
},
).Serial(dmtask.NewUpdateDMMeta(clusterName, metadata, gOpt.Nodes))
}
Expand Down Expand Up @@ -77,7 +77,6 @@ func ScaleInDMCluster(
getter operator.ExecutorGetter,
topo *dm.Specification,
options operator.Options,
publicKeyPath string,
) error {
// instances by uuid
instances := map[string]dm.Instance{}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cluster/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ func (m *Manager) Display(clusterName string, opt operator.Options) error {
}

// Check if there is some instance in tombstone state
nodes, _ := operator.DestroyTombstone(ctx, t, true /* returnNodesOnly */, opt, tlsCfg, ctx.PublicKeyPath)
nodes, _ := operator.DestroyTombstone(ctx, t, true /* returnNodesOnly */, opt, tlsCfg)
if len(nodes) != 0 {
color.Green("There are some nodes can be pruned: \n\tNodes: %+v\n\tYou can destroy them with the command: `tiup cluster prune %s`", nodes, clusterName)
}
Expand Down
4 changes: 1 addition & 3 deletions pkg/cluster/operation/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,9 +477,8 @@ func DestroyTombstone(
returNodesOnly bool,
options Options,
tlsCfg *tls.Config,
publicKey string,
) (nodes []string, err error) {
return DestroyClusterTombstone(getter, cluster, returNodesOnly, options, tlsCfg, publicKey)
return DestroyClusterTombstone(getter, cluster, returNodesOnly, options, tlsCfg)
}

// DestroyClusterTombstone remove the tombstone node in spec and destroy them.
Expand All @@ -490,7 +489,6 @@ func DestroyClusterTombstone(
returNodesOnly bool,
options Options,
tlsCfg *tls.Config,
publicKey string,
) (nodes []string, err error) {
instCount := map[string]int{}
for _, component := range cluster.ComponentsByStartOrder() {
Expand Down
4 changes: 1 addition & 3 deletions pkg/cluster/operation/scale_in.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,8 @@ func ScaleIn(
cluster *spec.Specification,
options Options,
tlsCfg *tls.Config,
publicKeyPath string,
) error {
return ScaleInCluster(getter, cluster, options, tlsCfg, publicKeyPath)
return ScaleInCluster(getter, cluster, options, tlsCfg)
}

// ScaleInCluster scales in the cluster
Expand All @@ -84,7 +83,6 @@ func ScaleInCluster(
cluster *spec.Specification,
options Options,
tlsCfg *tls.Config,
publicKeyPath string,
) error {
// instances by uuid
instances := map[string]spec.Instance{}
Expand Down
4 changes: 2 additions & 2 deletions pkg/cluster/task/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ func (c *ClusterOperate) Execute(ctx *Context) error {
return errors.Annotate(err, "failed to destroy")
}
case operator.DestroyTombstoneOperation:
_, err := operator.DestroyTombstone(ctx, c.spec, false, c.options, c.tlsCfg, ctx.PublicKeyPath)
_, err := operator.DestroyTombstone(ctx, c.spec, false, c.options, c.tlsCfg)
if err != nil {
return errors.Annotate(err, "failed to destroy")
}
// print nothing
case operator.ScaleInOperation:
err := operator.ScaleIn(ctx, c.spec, c.options, c.tlsCfg, ctx.PublicKeyPath)
err := operator.ScaleIn(ctx, c.spec, c.options, c.tlsCfg)
if err != nil {
return errors.Annotate(err, "failed to scale in")
}
Expand Down

0 comments on commit 7c7cfea

Please sign in to comment.