OpenNebula / addon-context-linux

Linux VM Contextualization
Apache License 2.0
56 stars 73 forks source link

Support ID_LIKE in /etc/os-release if it exists #286

Closed codyro closed 1 year ago

codyro commented 1 year ago

An example use case is we utilize CloudLinux for a handful of servers, a commercial distribution based on RHEL. Since CloudLinux isn't supported by OpenNebula officially, it breaks some context functions, such as the network, due to how OS detection works.

This change proposes the detect_os function used to determine which OS it's the script is being run on and also sends along the ID_LIKE variable in the /etc/os-release file if it exists. Then we can loop over the ID_LIKE distributions to see if anything matches if the ID field doesn't match a supported OS.

No other context scripts rely on the detect_os helper function, so it should be safe to adjust what it returns without breaking other context scripts.