switch all urls to api v3

This commit is contained in:
wh1te909 2020-10-17 22:28:20 -07:00
parent 2d4e085b96
commit 3218680e46
4 changed files with 10 additions and 10 deletions

View File

@ -627,7 +627,7 @@ func (a *WindowsAgent) SyncMeshNodeID() {
return
}
url := fmt.Sprintf("%s/api/v1/%d/meshinfo/", a.Server, a.AgentPK)
url := fmt.Sprintf("%s/api/v3/%d/meshinfo/", a.Server, a.AgentPK)
req := &APIRequest{
URL: url,
Method: "GET",
@ -869,7 +869,7 @@ func (a *WindowsAgent) CleanupPythonAgent() {
// UpdateSalt downloads the latest salt minion and performs an update
func (a *WindowsAgent) UpdateSalt() {
url := fmt.Sprintf("%s/api/v2/%s/saltminion/", a.Server, a.AgentID)
url := fmt.Sprintf("%s/api/v3/%s/saltminion/", a.Server, a.AgentID)
req := &APIRequest{
URL: url,
Headers: a.Headers,
@ -956,7 +956,7 @@ func (a *WindowsAgent) UpdateSalt() {
WaitForService("salt-minion", "running", 10)
req.URL = a.Server + "/api/v2/saltminion/"
req.URL = a.Server + "/api/v3/saltminion/"
req.Method = "PUT"
req.Payload = map[string]string{"ver": data.LatestVer, "agent_id": a.AgentID}
_, _ = req.MakeRequest()

View File

@ -120,7 +120,7 @@ func (a *WindowsAgent) Install(i *Installer) {
if i.LocalMesh == "" {
a.Logger.Infoln("Downloading mesh agent...")
payload := map[string]string{"arch": arch}
r, err := rClient.R().SetBody(payload).SetOutput(mesh).Post(fmt.Sprintf("%s/api/v2/meshexe/", baseURL))
r, err := rClient.R().SetBody(payload).SetOutput(mesh).Post(fmt.Sprintf("%s/api/v3/meshexe/", baseURL))
if err != nil {
a.installerMsg(fmt.Sprintf("Failed to download mesh agent: %s", err.Error()), "error")
}
@ -139,7 +139,7 @@ func (a *WindowsAgent) Install(i *Installer) {
Token string `json:"token"`
}
payload := map[string]string{"agent_id": a.AgentID}
r, err := rClient.R().SetBody(payload).SetResult(&TokenResp{}).Post(fmt.Sprintf("%s/api/v2/newagent/", baseURL))
r, err := rClient.R().SetBody(payload).SetResult(&TokenResp{}).Post(fmt.Sprintf("%s/api/v3/newagent/", baseURL))
if err != nil {
a.installerMsg(err.Error(), "error")
}
@ -208,7 +208,7 @@ func (a *WindowsAgent) Install(i *Installer) {
"monitoring_type": i.AgentType,
}
r, err = rClient.R().SetBody(agentPayload).SetResult(&NewAgentResp{}).Patch(fmt.Sprintf("%s/api/v2/newagent/", baseURL))
r, err = rClient.R().SetBody(agentPayload).SetResult(&NewAgentResp{}).Patch(fmt.Sprintf("%s/api/v3/newagent/", baseURL))
if err != nil {
a.installerMsg(err.Error(), "error")
}
@ -307,7 +307,7 @@ func (a *WindowsAgent) Install(i *Installer) {
acceptAttempts := 0
acceptRetries := 20
for {
r, err := rClient.R().SetBody(acceptPayload).Post(fmt.Sprintf("%s/api/v2/saltminion/", baseURL))
r, err := rClient.R().SetBody(acceptPayload).Post(fmt.Sprintf("%s/api/v3/saltminion/", baseURL))
if err != nil {
a.Logger.Debugln(err)
acceptAttempts++
@ -338,7 +338,7 @@ func (a *WindowsAgent) Install(i *Installer) {
syncAttempts := 0
syncRetries := 20
for {
r, err := rClient.R().SetBody(syncPayload).Patch(fmt.Sprintf("%s/api/v2/saltminion/", baseURL))
r, err := rClient.R().SetBody(syncPayload).Patch(fmt.Sprintf("%s/api/v3/saltminion/", baseURL))
if err != nil {
a.Logger.Debugln(err)
syncAttempts++

View File

@ -36,7 +36,7 @@ func (a *WindowsAgent) WinAgentSvc() {
var data map[string]interface{}
var sleep int
url := a.Server + "/api/v2/hello/"
url := a.Server + "/api/v3/hello/"
req := &APIRequest{
URL: url,
Headers: a.Headers,

View File

@ -1216,7 +1216,7 @@ func (a *WindowsAgent) GetWMI() {
wmiInfo["cpu"] = cpu
wmiInfo["usb"] = usb
url := a.Server + "/api/v2/sysinfo/"
url := a.Server + "/api/v3/sysinfo/"
payload := map[string]interface{}{"agent_id": a.AgentID, "sysinfo": wmiInfo}
req := &APIRequest{