apache / trafficcontrol

Apache Traffic Control is an Open Source implementation of a Content Delivery Network
https://trafficcontrol.apache.org/
Apache License 2.0
1.08k stars 344 forks source link

500 Internal Server Error on clicking Generate ISO from ISO page #4232

Open lbathina opened 4 years ago

lbathina commented 4 years ago

I'm submitting a ...

Traffic Control components affected ...

Minimal reproduction of the problem with instructions:

click on tools Generate ISO enter the details Click on Generate ISO button

Current behavior:

500 Internal server error

Expected / new behavior:

can someone fill this? I am not sure what is expected here.

Anything else:

ocket8888 commented 4 years ago

Can you post the Traffic Ops logs? Would be Perl if you're using an older version, Go if using anything around the 4.0 RC

mitchell852 commented 4 years ago

@lbathina ^^

Must be Perl since the Go rewrite of this endpoint is still in progress - #4203

mitchell852 commented 4 years ago

enter the details

also, the "details" might be important to determine the cause of the 500 as I believe this endpoint doesn't do a lot of validation.

rawlinp commented 4 years ago

This is probably due to the change in the /osversions API -- the osversions.cfg file was changed from a Perl file to json, so that config file needs converted before /api/*/osversions can be used.

lbathina commented 4 years ago

sorry missed this. few mins posting more info

lbathina commented 4 years ago

"POST /api/1.4/isos? HTTP/1.1" 500 1528 26 "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/<ip removed> Safari/537.36" this was in traffic_ops access.log. don't see anythin in error.log.

lbathina commented 4 years ago

/var/www/files/centos72/ks_scripts/network.cfg: No such file or directory at /opt/traffic_ops/app/lib/API/Iso.pm line 175, <RESOLV> line 4. in traffic_ops.log, however, I don't see it being logged while the action is being performed

rawlinp commented 4 years ago

Oh, in that case, this is unrelated to the changes to /osversions. This API requires some environment-specific config files on the TO host in order for this API to work properly. So, maybe the API should just return a nice error message if the required files don't exist (not sure if that should be a 5xx or a 4xx though).

mitchell852 commented 4 years ago

This API requires some environment-specific config files on the TO host in order for this API to work properly.

So maybe this is not a bug as it works fine IF everything if the enviro is setup properly? So maybe this is an API improvement instead? (provide better error/error message when environment setup is incomplete to support this API).

ocket8888 commented 4 years ago

"So maybe this is not a bug as it works fine IF everything if the enviro is setup properly? So maybe this is an API improvement instead?"

Agree. But I believe our standard behavior for bad/missing configuration causing an API endpoint to not function (e.g. no available InfluxDB servers for stats requests, no configured mailserver etc.) is to not expose that information through the API. That wasn't a mailing list decision afaik but it was pointed out in comments of one or two PRs in the past (that I'm aware of). So according to that philosophy we should just log the problem and hand back a 500 Internal Server Error to the client, I think.

mitchell852 commented 4 years ago

@ocket8888 - want to change the label to improvement?