Commit 1422e68c authored by Stefan Dähling's avatar Stefan Dähling
Browse files

fixes

parent f2399125
Pipeline #266409 passed with stages
in 2 minutes and 24 seconds
......@@ -270,6 +270,7 @@ func (ams *AMS) configureMAS(masSpec schemas.MASSpec) (masInfo schemas.MASInfo,
// total number of agents and total number of agencies
masInfo.Agents.Counter = 0
numAgencies = make([]int, masInfo.ImageGroups.Counter, masInfo.ImageGroups.Counter)
for i := range masSpec.ImageGroups {
masInfo.Agents.Counter += len(masSpec.ImageGroups[i].Agents)
num := len(masSpec.ImageGroups[i].Agents) / masSpec.Config.NumAgentsPerAgency
......
......@@ -195,7 +195,7 @@ func GetAgencyInfo(masID int, imID int, agencyID int) (agency schemas.AgencyInfo
httpStatus int, err error) {
var body []byte
body, httpStatus, err = httpretry.Get(httpClient, "http://"+Host+":"+strconv.Itoa(Port)+
"/api/clonemap/mas/"+strconv.Itoa(masID)+"/imgroup/"+strconv.Itoa(imID)+"/"+
"/api/clonemap/mas/"+strconv.Itoa(masID)+"/imgroup/"+strconv.Itoa(imID)+"/agency/"+
strconv.Itoa(agencyID), time.Second*2, 2)
if err != nil {
return
......
......@@ -47,6 +47,7 @@ package kubestub
import (
"errors"
"fmt"
"os/exec"
"strconv"
"strings"
......@@ -231,11 +232,12 @@ func (stub *LocalStub) deleteMQTT() (err error) {
// createAgency starts a new agency docker image
func (stub *LocalStub) createAgency(image string, masID int, imID int, agencyID int, logging bool,
mqtt bool, df bool) (err error) {
com := "docker run -d"
com += " --name=mas-" + strconv.Itoa(masID) + "-im-" + strconv.Itoa(imID) + "-agency-" +
strconv.Itoa(agencyID) + ".mas" + strconv.Itoa(masID) + "agencies"
com += " --hostname=mas-" + strconv.Itoa(masID) + "-im-" + strconv.Itoa(imID) + "-agency-" +
agencyName := "mas-" + strconv.Itoa(masID) + "-im-" + strconv.Itoa(imID) + "-agency-" +
strconv.Itoa(agencyID)
fmt.Println("Create agency " + agencyName + " from image " + image)
com := "docker run -d"
com += " --name=" + agencyName + ".mas" + strconv.Itoa(masID) + "agencies"
com += " --hostname=" + agencyName
com += " --network=clonemap-net"
//com += " -e CLONEMAP_SUFFIX=\".clonemap\" "
if logging {
......
......@@ -95,9 +95,6 @@ func (stub *LocalStub) handleAPI(w http.ResponseWriter, r *http.Request) {
}
}
if !agexist {
agname := "mas-" + strconv.Itoa(agconfig.MASID) + "-agency-" +
strconv.Itoa(agconfig.AgencyID)
fmt.Println("Create Agency Container " + agname)
err = stub.createAgency(agconfig.Image, agconfig.MASID, agconfig.ImageGroupID,
agconfig.AgencyID, agconfig.Logging, agconfig.MQTT, agconfig.DF)
if err == nil {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment