ocket8888 opened a new pull request #4763: URL: https://github.com/apache/trafficcontrol/pull/4763
## What does this PR (Pull Request) do? This PR features a rewrite of postinstall to Python3 (specifically the `_postinstall` Perl script). This is important because the Perl version of the script depended upon multiple libraries installed as dependencies of the Perl version of Traffic Ops - and if we are ever to get rid of that TO version things that depend on its dependencies will need to be reworked. The new `postinstall.py` script has no dependencies outside of the Python3 standard library, and features several unit tests and an end-to-end test bash script whereas the Perl version had only a single unit test (executed at run time on every run). To be clear, though, it - like the Perl script it is intended to replace - has dependencies on external programs including `wget`, `openssl` and `psql`. `wget` is only needed for Maxmind download support, so it could possibly be removed as the hard-coded URLs don't work anyway, but is left in for consistency with the old script. Besides that, its only external dependencies are already dependencies of TO - even the Go version - and the Python3 interpreter itself. Finally, I should mention that this doesn't actually replace the old script, which is totally untouched, but provides the new Python script as an alternative. May machines running TO in the wild may not have Python3 installed yet, so it may be too soon yet to require that for TO installations/upgrades. - [x] This PR is not related to any Issue ## Which Traffic Control components are affected by this PR? - Traffic Ops ## What is the best way to verify this PR? To run the doctests, use `python -m doctest path/to/postinstall.py`. That should output nothing and exit successfully (my `python` is a Python3 interpreter, if yours is Python2 then ~~upgrade please, Python2 is dead~~ you'll need to use `python3 -m doctest path/to/postinstall.py` instead). To run the end-to-end tests, use the `postinstall.test.sh` script, which should also output nothing (except spitting out some ssl keys/certs/requests in the current directory) and exit successfully. ## The following criteria are ALL met by this PR - [x] This PR includes tests - [x] Documentation is unnecessary - this isn't actually used yet. It does have docstrings and a `-h`/`--help` option, though - [x] An update to CHANGELOG.md is not necessary - [x] This PR includes any and all required license headers - [k] This PR does not include a database migration - [x] This PR **DOES NOT FIX A SERIOUS SECURITY VULNERABILITY** ---------------------------------------------------------------- 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]
