diff options
author | Igor Galić <me+github@igalic.co> | 2019-11-25 23:10:50 +0100 |
---|---|---|
committer | Chad Smith <chad.smith@canonical.com> | 2019-11-25 15:10:50 -0700 |
commit | 2a135c4a421af47f5bd511e89e385a72f62bde33 (patch) | |
tree | 9abda1673b01fa4838874adb3a8551282552d984 /cloudinit/config/cc_set_hostname.py | |
parent | aa935aefd2a01e792a397a28a915f0e029aeaed6 (diff) | |
download | vyos-cloud-init-2a135c4a421af47f5bd511e89e385a72f62bde33.tar.gz vyos-cloud-init-2a135c4a421af47f5bd511e89e385a72f62bde33.zip |
FreeBSD: fix for get_linux_distro() and lru_cache (#59)
Since `is_FreeBSD()` is used a lot, which uses `system_info()`, which uses `get_linux_distro()` we add caching, by decorating the following functions with `@lru_cache`:
- get_architecture()
- _lsb_release()
- is_FreeBSD
- get_linux_distro
- system_info()
- _get_cmdline()
Since [functools](https://docs.python.org/3/library/functools.html) only exists in Python 3, only python 3 will benefit from this improvement. For python 2, our shim is just a pass-thru. Too bad, but, also… https://pythonclock.org/
The main motivation here was, at first, to cache more, following the style of _lsb_release.
That is now consolidated under this very same roof.
LP: #1815030
Diffstat (limited to 'cloudinit/config/cc_set_hostname.py')
0 files changed, 0 insertions, 0 deletions