mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add Python 2.4 support to modprobe module
This commit is contained in:
parent
27a08dc647
commit
58620ca477
1 changed files with 8 additions and 3 deletions
|
@ -57,9 +57,14 @@ def main():
|
|||
|
||||
# Check if module is present
|
||||
try:
|
||||
with open('/proc/modules') as modules:
|
||||
present = any(module.startswith(args['name'] + ' ') for module in modules)
|
||||
except IOError as e:
|
||||
modules = open('/proc/modules')
|
||||
present = False
|
||||
for line in modules:
|
||||
if line.startswith(args['name'] + ' '):
|
||||
present = True
|
||||
break
|
||||
modules.close()
|
||||
except IOError, e:
|
||||
module.fail_json(msg=str(e), **args)
|
||||
|
||||
# Check only; don't modify
|
||||
|
|
Loading…
Reference in a new issue