salt
salt copied to clipboard
grains: Split os_data into smaller functions
The os_data
function is huge (531 lines for one function is too long) and also deeply nested (8 levels deep). That make reading, modifying, and testing this function harder.
Split os_data
into smaller functions to a readable 167 lines with only a nesting level of three.
os_data
has a case-like statement to differentiate the different operating systems, but this is split into two parts.
To make the code more readable, combine all case-like statement in os_data
to use one long if-elif chain.
Rebased and added two more commits. os_data
is now much cleaner and readable.
Rebased and added a test case for _linux_lsb_distrib_data()
.
@dmurphy18 https://github.com/saltstack/salt/pull/61626 is the final merge request containing all changes. Since that merge request is big, I split it into multiple smaller chunks (that stack on each other). This merge request is the first one. I rebased it on master and resolved the conflict.
Why does this pull request need a changelog entry? It does not change anything for the user. Only https://github.com/saltstack/salt/pull/61626 has user facing changes and changelog entries.
@bdrung Sorry, so used to everything needing a changelog. You are correct, if it did not impact user and was only internal things it does not add a changelog, approving this
Thanks. The next pull request in this series is https://github.com/saltstack/salt/pull/61589