1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix for the new 2.8 feature to have modprobe check for builtins.

uname output includes a newline.  strip() the newline so that the
filepath we construct points to the right place.
This commit is contained in:
Toshio Kuratomi 2019-01-02 08:50:40 -08:00
parent 2d890105f1
commit eb4249c7da

View file

@ -52,6 +52,7 @@ EXAMPLES = '''
params: 'numdummies=2'
'''
import os.path
import shlex
import traceback
@ -94,7 +95,9 @@ def main():
command = [module.get_bin_path('uname', True), '-r']
rc, uname_kernel_release, err = module.run_command(command)
module_file = '/' + name + '.ko'
with open('/lib/modules/' + uname_kernel_release + '/modules.builtin') as builtins:
builtin_path = os.path.join('/lib/modules/', uname_kernel_release.strip(),
'modules.builtin')
with open(builtin_path) as builtins:
for line in builtins:
if line.endswith(module_file):
present = True