mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Improve modules check
There are actually two improvements here. 1) this.ko.bak and that.konan won't match anymore 2) Both lines become constant time opperations rather than having to seek from beggining to end of each string looking for the extension.
This commit is contained in:
parent
107c265664
commit
6a9f9fb51d
@ -53,8 +53,8 @@ def available():
|
||||
mod_dir = os.path.join('/lib/modules/', os.uname()[2])
|
||||
for root, dirs, files in os.walk(mod_dir):
|
||||
for fn_ in files:
|
||||
if '.ko' in fn_:
|
||||
ret.append(fn_[:fn_.index('.ko')])
|
||||
if fn_.endswith('.ko'):
|
||||
ret.append(fn_[:-3])
|
||||
return sorted(list(ret))
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user