Replace the os_is_* functions
Ichimonji10 opened this issue · 0 comments
Ichimonji10 commented
The os_is_*
functions set a bad precedent. There's an enormous number of combinations of system facts that one might want to discover, and having os_is_*
functions is a recipe for an explosion in number of functions. A framework should provide more generalized tools that individual users can adapt to their needs.
A good solution would be to provide get_os_release
or get_redhat_release
functions that would return a dict of key/value pairs. Plugins could then write code like:
def os_is_f27():
os_release = get_os_release()
return os_release['ID'] == 'fedora' and os_release['VERSION_ID'] == '27'
Or, if the implementation of that becomes problematic, something like this would still be much nicer:
def os_is_f27():
return get_os_release_id() == 'fedora' and get_os_release_version_id == '27'