mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
amqp: fix broken validation of AMQP status updates
This commit is contained in:
parent
807be66c55
commit
a67ebb5429
1 changed files with 6 additions and 2 deletions
|
@ -59,6 +59,7 @@ type ICStatus struct {
|
|||
}
|
||||
|
||||
type ICProperties struct {
|
||||
UUID string `json:"uuid"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Location string `json:"location"`
|
||||
|
@ -234,8 +235,7 @@ func processMessage(message amqp.Delivery) error {
|
|||
return fmt.Errorf("AMQP: Could not unmarshal message to JSON: %v err: %v", string(message.Body), err)
|
||||
}
|
||||
|
||||
headers := amqp.Table(message.Headers)
|
||||
ICUUID := fmt.Sprintf("%v", headers["uuid"])
|
||||
ICUUID := payload.Properties.UUID
|
||||
_, err = uuid.Parse(ICUUID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("AMQP: UUID not valid: %v, message ignored: %v \n", ICUUID, string(message.Body))
|
||||
|
@ -283,6 +283,8 @@ func createExternalIC(payload ICUpdate, ICUUID string, body []byte) error {
|
|||
log.Println("AMQP: Aborting creation of IC with state gone")
|
||||
return nil
|
||||
}
|
||||
|
||||
newICReq.InfrastructureComponent.UUID = payload.Properties.UUID
|
||||
newICReq.InfrastructureComponent.Uptime = payload.Status.Uptime
|
||||
newICReq.InfrastructureComponent.WebsocketURL = payload.Properties.WS_url
|
||||
newICReq.InfrastructureComponent.APIURL = payload.Properties.API_url
|
||||
|
@ -338,6 +340,8 @@ func (s *InfrastructureComponent) updateExternalIC(payload ICUpdate, body []byte
|
|||
} else {
|
||||
updatedICReq.InfrastructureComponent.State = "unknown"
|
||||
}
|
||||
|
||||
updatedICReq.InfrastructureComponent.UUID = payload.Properties.UUID
|
||||
updatedICReq.InfrastructureComponent.Uptime = payload.Status.Uptime
|
||||
updatedICReq.InfrastructureComponent.Type = payload.Properties.Type
|
||||
updatedICReq.InfrastructureComponent.Category = payload.Properties.Category
|
||||
|
|
Loading…
Add table
Reference in a new issue