Skip to content

Commit

Permalink
Feature/remove not used file (#987)
Browse files Browse the repository at this point in the history
* feat(cluster,dm): set flags variables in flags module

* chore(*cluster/template): rm not used dm/prometheus.go

* refact(flags/debug): use localdata.Envxxx instead hard-write
  • Loading branch information
jsvisa authored Dec 15, 2020
1 parent 32d6f10 commit d36a601
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 112 deletions.
1 change: 1 addition & 0 deletions cmd/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ var envList = []string{
localdata.EnvNameKeepSourceTarget,
localdata.EnvNameMirrorSyncScript,
localdata.EnvNameLogPath,
localdata.EnvNameDebug,
}

func newEnvCmd() *cobra.Command {
Expand Down
2 changes: 0 additions & 2 deletions components/cluster/command/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ func init() {

colorutil.AddColorFunctionsForCobra()

// Initialize the global variables
flags.ShowBacktrace = len(os.Getenv("TIUP_BACKTRACE")) > 0
cobra.EnableCommandSorting = false

nativeEnvVar := strings.ToLower(os.Getenv(localdata.EnvNameNativeSSHClient))
Expand Down
3 changes: 0 additions & 3 deletions components/dm/command/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"github.com/pingcap/tiup/components/dm/spec"
"github.com/pingcap/tiup/pkg/cliutil"
"github.com/pingcap/tiup/pkg/cluster/executor"
"github.com/pingcap/tiup/pkg/cluster/flags"
"github.com/pingcap/tiup/pkg/cluster/manager"
operator "github.com/pingcap/tiup/pkg/cluster/operation"
cspec "github.com/pingcap/tiup/pkg/cluster/spec"
Expand Down Expand Up @@ -54,8 +53,6 @@ func init() {

colorutil.AddColorFunctionsForCobra()

// Initialize the global variables
flags.ShowBacktrace = len(os.Getenv("TIUP_BACKTRACE")) > 0
cobra.EnableCommandSorting = false

nativeEnvVar := strings.ToLower(os.Getenv(localdata.EnvNameNativeSSHClient))
Expand Down
10 changes: 5 additions & 5 deletions pkg/cluster/flags/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ package flags

import (
"os"

"github.com/pingcap/tiup/pkg/localdata"
)

// Global flags
var (
ShowBacktrace = false
DebugMode = false
DebugMode = false
)

func init() {
if s := os.Getenv("TIUP_CLUSTER_DEBUG"); s == "enable" {
DebugMode = true
}
val := os.Getenv(localdata.EnvNameDebug)
DebugMode = val == "enable" || val == "enabled"
}
102 changes: 0 additions & 102 deletions pkg/cluster/template/config/dm/prometheus.go

This file was deleted.

3 changes: 3 additions & 0 deletions pkg/localdata/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ const (
// EnvNameLogPath is the variable name by which user can write the log files into
EnvNameLogPath = "TIUP_LOG_PATH"

// EnvNameDebug is the variable name by which user can set tiup runs in debug mode(eg. print panic logs)
EnvNameDebug = "TIUP_CLUSTER_DEBUG"

// MetaFilename represents the process meta file name
MetaFilename = "tiup_process_meta"
)

0 comments on commit d36a601

Please sign in to comment.