agent: clean up

This commit is contained in:
Gyu-Ho Lee 2017-01-09 13:36:31 -08:00
parent 40c7ef8e6e
commit 9112a2f02b
No known key found for this signature in database
GPG Key ID: 1DDD39C7EB70C24C
4 changed files with 14 additions and 6 deletions

View File

@ -27,6 +27,7 @@ func startCetcd(fs *flags, t *transporterServer, req *agentpb.Request) (*exec.Cm
if !exist(fs.cetcdExec) { if !exist(fs.cetcdExec) {
return nil, fmt.Errorf("cetcd binary %q does not exist", globalFlags.cetcdExec) return nil, fmt.Errorf("cetcd binary %q does not exist", globalFlags.cetcdExec)
} }
peerIPs := strings.Split(req.PeerIPString, "___") peerIPs := strings.Split(req.PeerIPString, "___")
clientURLs := make([]string, len(peerIPs)) clientURLs := make([]string, len(peerIPs))
for i, u := range peerIPs { for i, u := range peerIPs {

View File

@ -25,12 +25,14 @@ import (
// startConsul starts Consul. // startConsul starts Consul.
func startConsul(fs *flags, t *transporterServer, req *agentpb.Request) (*exec.Cmd, error) { func startConsul(fs *flags, t *transporterServer, req *agentpb.Request) (*exec.Cmd, error) {
if err := os.RemoveAll(fs.consulDataDir); err != nil {
return nil, err
}
if !exist(fs.consulExec) { if !exist(fs.consulExec) {
return nil, fmt.Errorf("Consul binary %q does not exist", globalFlags.consulExec) return nil, fmt.Errorf("Consul binary %q does not exist", globalFlags.consulExec)
} }
if err := os.RemoveAll(fs.consulDataDir); err != nil {
return nil, err
}
peerIPs := strings.Split(req.PeerIPString, "___") peerIPs := strings.Split(req.PeerIPString, "___")
var flags []string var flags []string

View File

@ -25,12 +25,14 @@ import (
// startEtcd starts etcd v2 and v3. // startEtcd starts etcd v2 and v3.
func startEtcd(fs *flags, t *transporterServer, req *agentpb.Request) (*exec.Cmd, error) { func startEtcd(fs *flags, t *transporterServer, req *agentpb.Request) (*exec.Cmd, error) {
if err := os.RemoveAll(fs.etcdDataDir); err != nil {
return nil, err
}
if !exist(fs.etcdExec) { if !exist(fs.etcdExec) {
return nil, fmt.Errorf("etcd binary %q does not exist", globalFlags.etcdExec) return nil, fmt.Errorf("etcd binary %q does not exist", globalFlags.etcdExec)
} }
if err := os.RemoveAll(fs.etcdDataDir); err != nil {
return nil, err
}
peerIPs := strings.Split(req.PeerIPString, "___") peerIPs := strings.Split(req.PeerIPString, "___")
names := make([]string, len(peerIPs)) names := make([]string, len(peerIPs))

View File

@ -37,6 +37,9 @@ snapCount={{.SnapCount}}
{{range .Peers}}server.{{.MyID}}={{.IP}}:2888:3888 {{range .Peers}}server.{{.MyID}}={{.IP}}:2888:3888
{{end}} {{end}}
` `
// this is Zookeeper default configuration
// http://zookeeper.apache.org/doc/trunk/zookeeperAdmin.html
zkConfigDefault = ZookeeperConfig{ zkConfigDefault = ZookeeperConfig{
TickTime: 2000, TickTime: 2000,
ClientPort: "2181", ClientPort: "2181",