Skip to content

Commit

Permalink
cluster: add option for tmpdir
Browse files Browse the repository at this point in the history
  • Loading branch information
dveeden committed Feb 4, 2025
1 parent 8e15a03 commit b016e87
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions components/cluster/command/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ it will check the new instances `,
cmd.Flags().BoolVar(&opt.ApplyFix, "apply", false, "Try to fix failed checks")
cmd.Flags().BoolVar(&opt.ExistCluster, "cluster", false, "Check existing cluster, the input is a cluster name.")
cmd.Flags().Uint64Var(&gOpt.APITimeout, "api-timeout", 10, "Timeout in seconds when querying PD APIs.")
cmd.Flags().StringVarP(&opt.TempDir, "tempdir", "t", "/tmp/tiup", "The temporary directory.")

return cmd
}
6 changes: 4 additions & 2 deletions pkg/cluster/manager/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ type CheckOptions struct {
IdentityFile string // path to the private key file
UsePassword bool // use password instead of identity file for ssh connection
Opr *operator.CheckOptions
ApplyFix bool // try to apply fixes of failed checks
ExistCluster bool // check an exist cluster
ApplyFix bool // try to apply fixes of failed checks
ExistCluster bool // check an exist cluster
TempDir string // tempdir
}

// CheckCluster check cluster before deploying or upgrading
Expand Down Expand Up @@ -188,6 +189,7 @@ func checkSystemInfo(
applyFixTasks []*task.StepDisplay
downloadTasks []*task.StepDisplay
)
task.CheckToolsPathDir = opt.TempDir
logger := ctx.Value(logprinter.ContextKeyLogger).(*logprinter.Logger)
insightVer := ""

Expand Down
2 changes: 1 addition & 1 deletion pkg/cluster/task/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var (
)

// place the check utilities are stored
const (
var (
CheckToolsPathDir = "/tmp/tiup"
)

Expand Down

0 comments on commit b016e87

Please sign in to comment.