This Bug Report affects these Traffic Control components:
Current behavior:
Making a POST request to /api/3.0/servers with no profile key in the request returns:
HTTP/1.1 500 Internal Server Error
Content-Type: application/json
Transfer-Encoding: chunked
{
"alerts": [
{
"text": "Internal Server Error",
"level": "error"
}
]
}
Expected behavior:
I don't believe the profile key was required previously, however profileId has always been required. There should be no error when the profile key is missing.
Steps to reproduce:
Using the latest code from master spin up CiaB or CiaBDev and make a POST request to https://localhost:443/api/3.0/servers making sure the profile key is omitted (and all other Ids are valid):
e.g:
{
"cachegroupId": 8,
"cdnId": 2,
"domainName": "test.domain.net",
"hostName": "test-01",
"interfaces": [
{
"ipAddresses": [
{
"address": "0.0.0.1",
"gateway": "0.0.0.1",
"serviceAddress": true
}
],
"name": "eth0"
}
],
"physLocationId": 2,
"profileId": 13,
"statusId": 3,
"typeId": 11
}
Notes:
Traffic Ops error.log will show:
ERROR: api.go:263: 2022-04-25T20:53:03.2405179Z: 172.24.0.12:44922 panic: (err: runtime error: invalid memory address or nil pointer dereference) stacktrace:
goroutine 54669 [running]:
github.com/apache/trafficcontrol/lib/go-util.Stacktrace()
/tmp/go/src/github.com/apache/trafficcontrol/lib/go-util/util.go:32 +0x66
github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/routing/middleware.WrapPanicRecover.func1.1()
/tmp/go/src/github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/routing/middleware/wrappers.go:173 +0x66
panic({0xd134c0, 0x1500310})
/usr/local/go/src/runtime/panic.go:838 +0x207
github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/server.createV3(0xc001f370e0, {0xf9fef0, 0xc001ba7200}, 0xc000f3e800)
/tmp/go/src/github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/server/servers.go:1981 +0x2cc
There should probably be a check here or maybe this should be moved elsewhere:
|
origProfiles := []string{*server.Profile} |
This Bug Report affects these Traffic Control components:
Current behavior:
Making a
POSTrequest to/api/3.0/serverswith no profile key in the request returns:Expected behavior:
I don't believe the
profilekey was required previously, howeverprofileIdhas always been required. There should be no error when theprofilekey is missing.Steps to reproduce:
Using the latest code from master spin up CiaB or CiaBDev and make a
POSTrequest tohttps://localhost:443/api/3.0/serversmaking sure theprofilekey is omitted (and all other Ids are valid):e.g:
{ "cachegroupId": 8, "cdnId": 2, "domainName": "test.domain.net", "hostName": "test-01", "interfaces": [ { "ipAddresses": [ { "address": "0.0.0.1", "gateway": "0.0.0.1", "serviceAddress": true } ], "name": "eth0" } ], "physLocationId": 2, "profileId": 13, "statusId": 3, "typeId": 11 }Notes:
Traffic Ops error.log will show:
There should probably be a check here or maybe this should be moved elsewhere:
trafficcontrol/traffic_ops/traffic_ops_golang/server/servers.go
Line 1981 in 1aa8a5a