Report built-in modiles in kmod.available, fixes #43945

This commit is contained in:
Ivan Babrou 2017-10-06 16:23:46 -07:00
parent 9ac3f2ea7b
commit 95ab901553
No known key found for this signature in database
GPG key ID: DBF6C142408CB4F0

View file

@ -123,7 +123,16 @@ def available():
salt '*' kmod.available
'''
ret = []
mod_dir = os.path.join('/lib/modules/', os.uname()[2])
built_in_file = os.path.join(mod_dir, 'modules.builtin')
if os.path.exists(built_in_file):
with salt.utils.fopen(built_in_file, 'r') as f:
for line in f:
# Strip .ko from the basename
ret.append(os.path.basename(line)[:-4])
for root, dirs, files in os.walk(mod_dir):
for fn_ in files:
if '.ko' in fn_: