You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2019/12/11 23:24:09 UTC

[GitHub] [trafficcontrol] awilliams opened a new pull request #4203: TO: /isos rewrite

awilliams opened a new pull request #4203: TO: /isos rewrite
URL: https://github.com/apache/trafficcontrol/pull/4203
 
 
   ## What does this PR (Pull Request) do?
   - [x] This PR fixes #3801 such that the `/isos` handler has been rewritten in Go
   
   ## Which Traffic Control components are affected by this PR?
   
   - Documentation (TODO)
   - Traffic Control Client <!-- Please specify which; e.g. 'Python', 'Go', 'Java' -->
   - Traffic Monitor (TODO?)
   - Traffic Ops
   
   ## What is the best way to verify this PR?
   
   The majority of the code added is in the `./traffic_ops/traffic_ops_golang/iso` package, which includes a number of Go tests. To execute:
   
   ```shell
   go test ./traffic_ops/traffic_ops_golang/iso
   ```
   
   ## The following criteria are ALL met by this PR
   - [x] This PR includes tests OR I have explained why tests are unnecessary
   - [ ] This PR includes documentation OR I have explained why documentation is unnecessary
   - [ ] This PR includes an update to CHANGELOG.md OR such an update is not necessary
   - [x] This PR includes any and all required license headers
   - [x] This PR ensures that database migration sequence is correct OR this PR does not include a database migration
   - [x] This PR **DOES NOT FIX A SERIOUS SECURITY VULNERABILITY** (see [the Apache Software Foundation's security guidelines](https://www.apache.org/security/) for details)
   
   ## Additional Information
   
   - The Go version of the endpoint attempts to produce the same behavior as the Perl version. The exception is that the Go endpoint does not support non-streaming downloads. In Perl, non-streaming downloads worked by saving the ISO image to the server's disk and returning to the requesting client a URL that allowed them to download that file at a later time. If a non-streaming request is made to the Go endpoint, it returns an error in the standard JSON response structure. 
   
     This was discussed on the dev mailing list under the [_Proposal: Only allow streaming downloads of ISOs_](https://lists.apache.org/thread.html/60fd81126f54c1fbc831dc68bce7c87f00ecc5fccb6ca6457dc04772%40%3Cdev.trafficcontrol.apache.org%3E) subject. It was decided that this is a breaking API change, and therefore the Go API should be a version 2.0 endpoint.
   
   - The Perl version, when streaming the response, would fail silently if the subprocess failed ([code](https://github.com/apache/trafficcontrol/blob/19aa398b2550ee5f308b6678cba0647931efb381/traffic_ops/app/lib/API/Iso.pm#L264)). The Go version returns an error to the user in this case.
   
   - This PR adds a new Go library (https://github.com/GehirnInc/crypt). Relevant discussion on the mailing list was under message with subject: [_Proposal to add GehirnInc/crypt library_](https://lists.apache.org/thread.html/6da4dae2cefb4413a67c82132c7ba5b871e607793410384f96c6f863%40%3Cdev.trafficcontrol.apache.org%3E)
   
   - When creating the `mgmt_network.cfg` file, the Perl version does not quote the `DEVICE` value ([code](https://github.com/apache/trafficcontrol/blob/19aa398b2550ee5f308b6678cba0647931efb381/traffic_ops/app/lib/API/Iso.pm#L180)), while the Go version does.
   
   - It's likely that custom `generate` scripts will use the `implantisomd5` program provided on Centos by the `isomd5sum` package. The `mkisofs` package is already a [requirement](https://github.com/apache/trafficcontrol/blob/e3c48b6fde2a154acb5e557dba36dc615ec38b8e/traffic_ops/build/traffic_ops.spec#L36) of the TrafficOps RPM, so we should considering making `isomd5sum` a requirement as well.
   
   - There's a cronjob ([./traffic_ops/etc/cron.d/trafops_clean_isos](https://github.com/apache/trafficcontrol/blob/6d9b495ec72b9942956ce7cd47975634c4eae7f8/traffic_ops/etc/cron.d/trafops_clean_isos)) that removes stale ISO files. This isn't necessary for the Go version of this endpoint. Once the Perl endpoint becomes obsolete, it can likely be deleted. The Go version does no store copies of the ISO images, therefore there's no cleanup necessary.
   
   ### TODO
   
   - Documentation
   - Changelog
   - Change route to v2.0 and start discussion around this (this didn't seem to work in testing, maybe because of a bug in the routing code).
   - Use `osversions.json` to limit values that a user can request
   - Add client support?
   - Limit concurrency somehow, since requests could modify the same `/var/www/files` files?
   - Remove CIDR formatting from IP certain addresses, per [Perl version](https://github.com/apache/trafficcontrol/blob/19aa398b2550ee5f308b6678cba0647931efb381/traffic_ops/app/lib/API/Iso.pm#L181)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services