rob05c opened a new pull request #5247: URL: https://github.com/apache/trafficcontrol/pull/5247
Changes `lib/go-atscfg` to take standard `lib/go-tc` objects, instead of custom stuff. This makes it much easier to use as a library. Users can simply get objects from the TO API, and pass them to generate config, instead of having to build custom objects, with a lot of logic in their app. As a reminder, it didn't do this at first, because the custom objects were what we had in Traffic Ops from the DB; TO config files have now been removed. This also - changes the comment header to be the real TO URL that ORT has, use the same generation timestamp on all files, and include the TO IP(s). Should improve debugging. - changes `lib/go-atscfg` to track non-fatal warnings, and return them in a list, so the library itself doesn't log (libraries should never log) - changes `lib/go-atscfg` generation funcs to return real errors, instead of an "ERROR: " config file string (again, it did that because TO did it, which has now been removed). - Fixes a bug with ORT not fetching the latest servers, even though they were needed and added to `atstccfg/toreqnew`. Sorry for the size. If I tried to make all those things separate, they would've had terrible merge conflicts. For what it's worth, this should be a big improvement in production debugability, safety, better testing, not generating broken files, and better error and warning reporting. `lib/go-atscfg` has extensive unit tests, and they pass. Even better, with the custom-object logic now in the library, even more is being unit tested. I also manually tested generating both edges and mids on our two largest CDNs, they all diff identical, except the comment header and a ip_allow change/fix that's caused by the bug fix. This is all boilerplate changes, no logic. The actual config logic should be unchanged, and any logic change is a bug. Also for what it's worth, I'm hoping `lib/go-atscfg` is getting very close to "stable" and we can start supporting Go Modules and a "version promise" for the library. This is a huge step in that direction. Includes extensive tests. No docs, no interface change (outside the non-stable library). No changelog, no interface change. - [x] This PR is not related to any other Issue ## Which Traffic Control components are affected by this PR? - Traffic Ops ORT ## What is the best way to verify this PR? Run unit tests. Generate config with the `master` ORT, generate config with this PR, verify no changes (except the aforementioned comment header and corrected ip_allow CIDR). ## If this is a bug fix, what versions of Traffic Control are affected? Not a bug fix. The bug mentioned is in master, not in a release. ## The following criteria are ALL met by this PR - [x] This PR includes tests OR I have explained why tests are unnecessary - [x] This PR includes documentation OR I have explained why documentation is unnecessary - [x] 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 **DOES NOT FIX A SERIOUS SECURITY VULNERABILITY** (see [the Apache Software Foundation's security guidelines](https://www.apache.org/security/) for details) ## Additional Information ---------------------------------------------------------------- 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: [email protected]
