Skip to content

Commit 0b2da4f

Browse files
committed
Fix typo in func name.
1 parent 586152b commit 0b2da4f

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

cmd/mysql-helper/appclone/appclone.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func cloneFromBucket(initBucket string) error {
150150
func cloneFromSource(host string) error {
151151
glog.Infof("Cloning from node: %s", host)
152152

153-
backupBody, err := tb.RequestABackup(host, tb.ServerBackupPath)
153+
backupBody, err := tb.RequestABackup(host, tb.ServerBackupEndpoint)
154154
if err != nil {
155155
return fmt.Errorf("fail to get backup: %s", err)
156156
}

cmd/mysql-helper/apphelper/server.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"os/exec"
2626

2727
"github.com/golang/glog"
28-
tb "github.com/presslabs/mysql-operator/cmd/mysql-helper/util"
28+
"github.com/presslabs/mysql-operator/cmd/mysql-helper/util"
2929
)
3030

3131
type server struct {
@@ -36,14 +36,14 @@ func NewServer(stop <-chan struct{}) *server {
3636
mux := http.NewServeMux()
3737
srv := &server{
3838
Server: http.Server{
39-
Addr: fmt.Sprintf(":%d", tb.ServerPort),
39+
Addr: fmt.Sprintf(":%d", util.ServerPort),
4040
Handler: mux,
4141
},
4242
}
4343

4444
// Add handle functions
45-
mux.HandleFunc(tb.ServerProbePath, srv.healthHandle)
46-
mux.Handle(tb.ServerBackupPath, tb.MaxClients(http.HandlerFunc(srv.serveBackupHandle), 1))
45+
mux.HandleFunc(util.ServerProbeEndpoint, srv.healthHandler)
46+
mux.Handle(util.ServerBackupEndpoint, util.MaxClients(http.HandlerFunc(srv.backupHandler), 1))
4747

4848
// Shutdown gracefully the http server
4949
go func() {
@@ -56,12 +56,12 @@ func NewServer(stop <-chan struct{}) *server {
5656
return srv
5757
}
5858

59-
func (s *server) healthHandle(w http.ResponseWriter, r *http.Request) {
59+
func (s *server) healthHandler(w http.ResponseWriter, r *http.Request) {
6060
w.WriteHeader(http.StatusOK)
6161
w.Write([]byte("OK"))
6262
}
6363

64-
func (s *server) serveBackupHandle(w http.ResponseWriter, r *http.Request) {
64+
func (s *server) backupHandler(w http.ResponseWriter, r *http.Request) {
6565

6666
if !s.isAuthenticated(r) {
6767
http.Error(w, "Not authenticated!", http.StatusForbidden)
@@ -78,8 +78,8 @@ func (s *server) serveBackupHandle(w http.ResponseWriter, r *http.Request) {
7878
w.Header().Set("Connection", "keep-alive")
7979

8080
xtrabackup := exec.Command("xtrabackup", "--backup", "--slave-info", "--stream=xbstream",
81-
"--host=127.0.0.1", fmt.Sprintf("--user=%s", tb.GetReplUser()),
82-
fmt.Sprintf("--password=%s", tb.GetReplPass()))
81+
"--host=127.0.0.1", fmt.Sprintf("--user=%s", util.GetReplUser()),
82+
fmt.Sprintf("--password=%s", util.GetReplPass()))
8383

8484
xtrabackup.Stderr = os.Stderr
8585

@@ -115,5 +115,5 @@ func (s *server) serveBackupHandle(w http.ResponseWriter, r *http.Request) {
115115

116116
func (s *server) isAuthenticated(r *http.Request) bool {
117117
user, pass, ok := r.BasicAuth()
118-
return ok && user == tb.GetBackupUser() && pass == tb.GetBackupPass()
118+
return ok && user == util.GetBackupUser() && pass == util.GetBackupPass()
119119
}

cmd/mysql-helper/apptakebackup/apptakebackup.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424

2525
"github.com/golang/glog"
2626

27-
tb "github.com/presslabs/mysql-operator/cmd/mysql-helper/util"
27+
"github.com/presslabs/mysql-operator/cmd/mysql-helper/util"
2828
)
2929

3030
const (
@@ -39,15 +39,15 @@ func RunTakeBackupCommand(stopCh <-chan struct{}, srcHost, destBucket string) er
3939

4040
func pushBackupFromTo(srcHost, destBucket string) error {
4141

42-
backupBody, err := tb.RequestABackup(srcHost, tb.ServerBackupPath)
42+
backupBody, err := util.RequestABackup(srcHost, util.ServerBackupEndpoint)
4343
if err != nil {
4444
return fmt.Errorf("getting backup: %s", err)
4545
}
4646

4747
gzip := exec.Command("gzip", "-c")
4848

4949
rclone := exec.Command("rclone",
50-
fmt.Sprintf("--config=%s", tb.RcloneConfigFile), "rcat", destBucket)
50+
fmt.Sprintf("--config=%s", util.RcloneConfigFile), "rcat", destBucket)
5151

5252
gzip.Stdin = backupBody
5353
gzip.Stderr = os.Stderr

cmd/mysql-helper/util/util.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ var (
7070
NameOfStatefulSet = api.StatefulSet
7171

7272
// http server config
73-
ServerPort = mysqlcluster.HelperServerPort
74-
ServerProbePath = mysqlcluster.HelperServerProbePath
75-
ServerBackupPath = "/xtbackup"
73+
ServerPort = mysqlcluster.HelperServerPort
74+
ServerProbeEndpoint = mysqlcluster.HelperServerProbePath
75+
ServerBackupEndpoint = "/xbackup"
7676
)
7777

7878
const (
@@ -309,10 +309,10 @@ func MaxClients(h http.Handler, n int) http.Handler {
309309
})
310310
}
311311

312-
func RequestABackup(host, path string) (io.Reader, error) {
313-
glog.Infof("Initiate a backup from: %s path: %s", host, path)
312+
func RequestABackup(host, endpoint string) (io.Reader, error) {
313+
glog.Infof("Initiate a backup from: %s endpoint: %s", host, endpoint)
314314

315-
req, err := http.NewRequest("GET", fmt.Sprintf("http://%s:%d%s", host, ServerPort, path), nil)
315+
req, err := http.NewRequest("GET", fmt.Sprintf("http://%s:%d%s", host, ServerPort, endpoint), nil)
316316
if err != nil {
317317
return nil, fmt.Errorf("fail to create request: %s", err)
318318
}

0 commit comments

Comments
 (0)