V2.7 增加agent执行器
This commit is contained in:
@@ -10,8 +10,6 @@ package models
|
||||
import (
|
||||
"net/url"
|
||||
|
||||
"fmt"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/orm"
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
@@ -31,7 +29,6 @@ func Init(startTime int64) {
|
||||
dbport = "3306"
|
||||
}
|
||||
dsn := dbuser + ":" + dbpassword + "@tcp(" + dbhost + ":" + dbport + ")/" + dbname + "?charset=utf8"
|
||||
fmt.Println(dsn)
|
||||
if timezone != "" {
|
||||
dsn = dsn + "&loc=" + url.QueryEscape(timezone)
|
||||
}
|
||||
|
||||
@@ -16,22 +16,22 @@ import (
|
||||
)
|
||||
|
||||
type TaskServer struct {
|
||||
Id int
|
||||
GroupId int
|
||||
Id int
|
||||
GroupId int
|
||||
ConnectionType int
|
||||
ServerName string
|
||||
ServerAccount string
|
||||
ServerOuterIp string
|
||||
ServerIp string
|
||||
Port int
|
||||
Password string
|
||||
PrivateKeySrc string
|
||||
PublicKeySrc string
|
||||
Type int
|
||||
Detail string
|
||||
CreateTime int64
|
||||
UpdateTime int64
|
||||
Status int
|
||||
ServerName string
|
||||
ServerAccount string
|
||||
ServerOuterIp string
|
||||
ServerIp string
|
||||
Port int
|
||||
Password string
|
||||
PrivateKeySrc string
|
||||
PublicKeySrc string
|
||||
Type int
|
||||
Detail string
|
||||
CreateTime int64
|
||||
UpdateTime int64
|
||||
Status int
|
||||
}
|
||||
|
||||
func (t *TaskServer) TableName() string {
|
||||
@@ -97,6 +97,20 @@ func TaskServerGetById(id int) (*TaskServer, error) {
|
||||
return obj, nil
|
||||
}
|
||||
|
||||
func TaskServerForActuator(serverIp string, port int) int {
|
||||
serverFilters := make([]interface{}, 0)
|
||||
serverFilters = append(serverFilters, "status__in", []int{0, 1})
|
||||
serverFilters = append(serverFilters, "server_ip", serverIp)
|
||||
serverFilters = append(serverFilters, "port", port)
|
||||
|
||||
server, _ := TaskServerGetList(1, 1, serverFilters...)
|
||||
|
||||
if len(server) == 1 {
|
||||
return server[0].Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
//
|
||||
func TaskServerGetByIds(ids string) ([]*TaskServer, int64) {
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ type Task struct {
|
||||
Id int
|
||||
GroupId int
|
||||
ServerIds string
|
||||
ServerType int
|
||||
TaskName string
|
||||
Description string
|
||||
CronSpec string
|
||||
|
||||
Reference in New Issue
Block a user