Skip to content

Commit e5eee04

Browse files
ivanmatmatioktalz
authored andcommitted
BUG/MINOR: wrong config state file path in external mode
1 parent 731d32d commit e5eee04

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pkg/haproxy/env/main.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ func (env *Env) Init(osArgs utils.OSArgs) (err error) {
101101
return err
102102
}
103103
}
104-
_, err = os.Create(filepath.Join(env.StateDir, "global"))
105-
return err
104+
return
106105
}
107106

108107
// When controller is not running on a containerized
@@ -112,7 +111,7 @@ func (env *Env) external(osArgs utils.OSArgs) (err error) {
112111
env.MainCFGFile = "/tmp/haproxy-ingress/etc/haproxy.cfg"
113112
env.CfgDir = "/tmp/haproxy-ingress/etc"
114113
env.RuntimeDir = "/tmp/haproxy-ingress/run"
115-
env.StateDir = "/tmp/haproxy-ingress/state"
114+
env.StateDir = "/tmp/haproxy-ingress/state/"
116115
if osArgs.Program != "" {
117116
env.Binary = osArgs.Program
118117
}

pkg/haproxy/process/interface.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package process
33
import (
44
"bufio"
55
"os"
6+
"path/filepath"
67
"strconv"
78
"syscall"
89

@@ -69,7 +70,7 @@ func saveServerState(stateDir string, api runtime.Raw) error {
6970
return err
7071
}
7172
var f *os.File
72-
if f, err = os.Create(stateDir + "global"); err != nil {
73+
if f, err = os.Create(filepath.Join(stateDir, "global")); err != nil {
7374
logger.Error(err)
7475
return err
7576
}

0 commit comments

Comments
 (0)