diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2018-06-21 20:25:11 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2018-06-21 20:25:11 +0100 |
commit | 4aae08aee6b1f49b5fe5a76079f1cae9a75b9b6b (patch) | |
tree | b86f179b9098be303424279ba2288541ab4d1757 | |
parent | 2d4ab4c925d8283b3e04846e9e4bd8da1783031a (diff) | |
download | sos-4aae08aee6b1f49b5fe5a76079f1cae9a75b9b6b.tar.gz |
[fibrechannel] fix list comprehension filter scope
The 'devs' list comprehension generates a list of present FC sysfs
paths by filtering a list of possible directory paths with isdir().
The isdir() test must be on the outer ('for d in dirs') scope
rather than the inner: otherwise listdir() may be called with a
non-existent directory.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/fibrechannel.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sos/plugins/fibrechannel.py b/sos/plugins/fibrechannel.py index fdca6d47..9a28a3b4 100644 --- a/sos/plugins/fibrechannel.py +++ b/sos/plugins/fibrechannel.py @@ -29,7 +29,7 @@ class Fibrechannel(Plugin, RedHatPlugin): '/sys/class/fc_transport/' ] - devs = [join(d, dev) for d in dirs for dev in listdir(d) if isdir(d)] + devs = [join(d, dev) for d in dirs if isdir(d) for dev in listdir(d)] if devs: self.add_udev_info(devs, attrs=True) |