diff options
author | Pavel Moravec <pmoravec@redhat.com> | 2018-06-24 15:40:16 +0200 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2018-06-25 11:42:14 +0100 |
commit | f9539ea944dd178442be2b8dd77c2a976f7eddec (patch) | |
tree | fe68eb30c15ab3a37932091c7aa061d6e8ea66ba | |
parent | 9688e5c33f0db53f061907c5888ebb5957931c55 (diff) | |
download | sos-f9539ea944dd178442be2b8dd77c2a976f7eddec.tar.gz |
[kernel] handle case when bpftool installed but not implemented
on older kernels, bpftool can return error
"can't get next program: Function not implemented"
that lacks "id" we search for in the dict.
Resolves: #1363
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
-rw-r--r-- | sos/plugins/kernel.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sos/plugins/kernel.py b/sos/plugins/kernel.py index 719a6e1c..73109326 100644 --- a/sos/plugins/kernel.py +++ b/sos/plugins/kernel.py @@ -34,7 +34,8 @@ class Kernel(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): self._log_info("Could not parse bpftool prog list as JSON: %s" % e) return out for item in range(len(prog_data)): - out.append(prog_data[item]["id"]) + if "id" in prog_data[item]: + out.append(prog_data[item]["id"]) return out def get_bpftool_map_ids(self, map_file): @@ -45,7 +46,8 @@ class Kernel(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): self._log_info("Could not parse bpftool map list as JSON: %s" % e) return out for item in range(len(map_data)): - out.append(map_data[item]["id"]) + if "id" in map_data[item]: + out.append(map_data[item]["id"]) return out def setup(self): |