pool get
This commit is contained in:
parent
2dc142a13b
commit
0c57e212ad
|
@ -31,6 +31,5 @@ func listRun(cmd *SockCommand, writer *bufio.Writer, path string, args ...string
|
|||
fmt.Print("List\n")
|
||||
for name, dep := range conf.GetConf().Deployments {
|
||||
writer.WriteString(name+" (ports " + strconv.Itoa(dep.Pool.Low) +":"+strconv.Itoa(dep.Pool.High)+") : "+dep.Path+"\n")
|
||||
fmt.Print(name+" (ports " + strconv.Itoa(dep.Pool.Low) +":"+strconv.Itoa(dep.Pool.High)+") : "+dep.Path+"\n")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
//"github.com/dballard/warren/cmd/warrend/conf"
|
||||
"github.com/dballard/warren/cmd/warrend/conf"
|
||||
"github.com/dballard/warren/lib/warren"
|
||||
"bufio"
|
||||
"strings"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
var poolUsage = `
|
||||
|
@ -23,14 +23,15 @@ var poolCmd = &SockCommand{
|
|||
// pool [name] -- get
|
||||
// pool [name] [low] [high] -- set
|
||||
func poolRun(cmd *SockCommand, writer *bufio.Writer, path string, args ...string) {
|
||||
if len(args) > 0 && args[0] == "help" {
|
||||
if len(args) == 0 || args[0] == "" || (len(args) > 0 && args[0] == "help") {
|
||||
writer.WriteString(cmd.Usage)
|
||||
return
|
||||
}
|
||||
|
||||
// GET
|
||||
if len(args) == 1 {
|
||||
writer.WriteString("Pool GET " + strings.Join(args, ", ") + "\n")
|
||||
deployment := conf.GetConfFor(args[0])
|
||||
writer.WriteString("Pool " + strconv.Itoa(deployment.Pool.Low) + " to " + strconv.Itoa(deployment.Pool.High))
|
||||
return
|
||||
}
|
||||
if len(args) == 3 {
|
||||
|
|
|
@ -104,6 +104,14 @@ func GetConf() *Conf {
|
|||
return conf
|
||||
}
|
||||
|
||||
func GetConfFor(depName string) *Deployment {
|
||||
deployment, ok := conf.Deployments[depName]
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
return &deployment
|
||||
}
|
||||
|
||||
func Run() {
|
||||
loadConf()
|
||||
if conf == nil {
|
||||
|
@ -131,5 +139,4 @@ func Run() {
|
|||
}
|
||||
m.reply <- err
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -70,7 +70,6 @@ func sockCmdHandle(c net.Conn) {
|
|||
icmd.(*SockCommand).Exec(writer, args[0], args[2:])
|
||||
writer.WriteByte(0)
|
||||
writer.Flush()
|
||||
fmt.Println("flushed")
|
||||
}
|
||||
|
||||
// determine if warrend is already running
|
||||
|
|
Loading…
Reference in New Issue