mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 20:31:27 -07:00
[PR #8005/e0dbe9c9 backport][stable-7] modprobe: Avoid FileNotFoundError when directories don't exist. (#8027)
modprobe: Avoid FileNotFoundError when directories don't exist. (#8005)
* Avoid FileNotFoundError when directories don't exist.
* Adds changelog fragment.
* Update changelogs/fragments/7717-prevent-modprobe-error.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit e0dbe9c98d
)
Co-authored-by: Nate Douglas <ndouglas@users.noreply.github.com>
This commit is contained in:
parent
3fd8c520c6
commit
faa3b7349f
2 changed files with 6 additions and 0 deletions
|
@ -232,12 +232,16 @@ class Modprobe(object):
|
|||
|
||||
@property
|
||||
def modules_files(self):
|
||||
if not os.path.isdir(MODULES_LOAD_LOCATION):
|
||||
return []
|
||||
modules_paths = [os.path.join(MODULES_LOAD_LOCATION, path)
|
||||
for path in os.listdir(MODULES_LOAD_LOCATION)]
|
||||
return [path for path in modules_paths if os.path.isfile(path)]
|
||||
|
||||
@property
|
||||
def modprobe_files(self):
|
||||
if not os.path.isdir(PARAMETERS_FILES_LOCATION):
|
||||
return []
|
||||
modules_paths = [os.path.join(PARAMETERS_FILES_LOCATION, path)
|
||||
for path in os.listdir(PARAMETERS_FILES_LOCATION)]
|
||||
return [path for path in modules_paths if os.path.isfile(path)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue