Skip to content

Commit 7301224

Browse files
authored
[6.17.z] Fix OSP compute resource cleanup (#22230)
1 parent e64b778 commit 7301224

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

tests/foreman/cli/test_computeresource_osp.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,12 @@
2929
class TestOSPComputeResourceTestCase:
3030
"""OSPComputeResource CLI tests."""
3131

32-
def cr_cleanup(self, cr_id, id_type, target_sat):
32+
def cr_cleanup(self, id_type, value, target_sat):
3333
"""Finalizer for removing CR from Satellite.
3434
This should remove ssh key pairs from OSP in case of test fail.
3535
"""
36-
try:
37-
target_sat.cli.ComputeResource.delete({id_type: cr_id})
38-
assert not target_sat.cli.ComputeResource.exists(search=(id_type, cr_id))
39-
except CLIReturnCodeError:
40-
pass
36+
target_sat.cli.ComputeResource.delete({id_type: value})
37+
assert not target_sat.cli.ComputeResource.exists(search=(id_type, value))
4138

4239
@pytest.fixture
4340
def osp_version(request):
@@ -76,7 +73,9 @@ def test_crud_and_duplicate_name(self, request, id_type, osp_version, target_sat
7673
'url': osp_version,
7774
}
7875
)
79-
request.addfinalizer(lambda: self.cr_cleanup(compute_resource['id'], id_type, target_sat))
76+
request.addfinalizer(
77+
lambda: self.cr_cleanup(id_type, compute_resource[id_type], target_sat)
78+
)
8079
assert compute_resource['name'] == name
8180
assert target_sat.cli.ComputeResource.exists(search=(id_type, compute_resource[id_type]))
8281

0 commit comments

Comments
 (0)