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