Skip to content

Commit

Permalink
Skip LuksDevices combiner if there are no results
Browse files Browse the repository at this point in the history
Signed-off-by: daniel.zatovic <[email protected]>
  • Loading branch information
danzatt committed Oct 12, 2022
1 parent 2b94177 commit 166d689
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions insights/combiners/cryptsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import copy

from insights import SkipComponent
from insights.core.plugins import combiner
from insights.parsers.cryptsetup_luksDump import LuksDump
from insights.parsers.luksmeta import LuksMeta
Expand Down Expand Up @@ -50,3 +51,6 @@ def __init__(self, luks_dumps, luks_metas):
luks_dump_copy["luksmeta"] = luksmeta_by_uuid[uuid]

self.append(luks_dump_copy)

if not self:
raise SkipComponent
5 changes: 5 additions & 0 deletions insights/tests/combiners/test_cryptsetup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import doctest
import pytest

from insights import SkipComponent
from insights.parsers.cryptsetup_luksDump import LuksDump
from insights.parsers import luksmeta
from insights.combiners.cryptsetup import LuksDevices
Expand Down Expand Up @@ -158,6 +160,9 @@


def test_luks_devices_combiner():
with pytest.raises(SkipComponent):
luks_devices = LuksDevices([], None)

luks_devices = LuksDevices([luks1_device, luks2_device], None)
for device in luks_devices:
assert "luksmeta" not in device
Expand Down

0 comments on commit 166d689

Please sign in to comment.