From 7c7cfea4e652c99e299a1ce9e61921881e7c6564 Mon Sep 17 00:00:00 2001 From: 9547 Date: Mon, 23 Nov 2020 23:09:23 +0800 Subject: [PATCH] fix(cluster,dm): don't pass ctx.PublicKeyPath --- components/cluster/command/prune.go | 4 ++-- components/dm/command/scale_in.go | 3 +-- pkg/cluster/manager.go | 2 +- pkg/cluster/operation/destroy.go | 4 +--- pkg/cluster/operation/scale_in.go | 4 +--- pkg/cluster/task/action.go | 4 ++-- 6 files changed, 8 insertions(+), 13 deletions(-) diff --git a/components/cluster/command/prune.go b/components/cluster/command/prune.go index c1635f02b0..3faca3fe6f 100644 --- a/components/cluster/command/prune.go +++ b/components/cluster/command/prune.go @@ -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) } @@ -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) } diff --git a/components/dm/command/scale_in.go b/components/dm/command/scale_in.go index a56510b345..f2459e59ed 100644 --- a/components/dm/command/scale_in.go +++ b/components/dm/command/scale_in.go @@ -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)) } @@ -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{} diff --git a/pkg/cluster/manager.go b/pkg/cluster/manager.go index 7de201c9f3..ad661556b7 100644 --- a/pkg/cluster/manager.go +++ b/pkg/cluster/manager.go @@ -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) } diff --git a/pkg/cluster/operation/destroy.go b/pkg/cluster/operation/destroy.go index 8e3e4c4321..58b6a6a403 100644 --- a/pkg/cluster/operation/destroy.go +++ b/pkg/cluster/operation/destroy.go @@ -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. @@ -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() { diff --git a/pkg/cluster/operation/scale_in.go b/pkg/cluster/operation/scale_in.go index fbdb68c7ed..3b8ee1a171 100644 --- a/pkg/cluster/operation/scale_in.go +++ b/pkg/cluster/operation/scale_in.go @@ -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 @@ -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{} diff --git a/pkg/cluster/task/action.go b/pkg/cluster/task/action.go index d46d46716a..e600998a7b 100644 --- a/pkg/cluster/task/action.go +++ b/pkg/cluster/task/action.go @@ -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") }