From ac59e80b1a7ea268b700b362d4b3be8d03341dce Mon Sep 17 00:00:00 2001 From: Gonzalo Rafuls Date: Fri, 15 Sep 2023 14:18:57 +0200 Subject: [PATCH 1/2] fix: iDRAC8 / R630 boot_to --- src/badfish/main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/badfish/main.py b/src/badfish/main.py index 9953fd3..01a2539 100755 --- a/src/badfish/main.py +++ b/src/badfish/main.py @@ -1071,11 +1071,13 @@ async def reset_bios(self): self.logger.info("BIOS will now reset and be back online within a few minutes.") return True - async def boot_to(self, device): + async def boot_to(self, device, skip_job=False): device_check = await self.check_device(device) if device_check: await self.clear_job_queue() await self.send_one_time_boot(device) + if not skip_job: + await self.create_bios_config_job(self.bios_uri) else: return False return True @@ -1453,7 +1455,7 @@ async def boot_to_virtual_media(self): else: vcd_check = await self.check_device("Optical.iDRACVirtual.1-1") if vcd_check: - await self.boot_to("Optical.iDRACVirtual.1-1") + await self.boot_to("Optical.iDRACVirtual.1-1", True) else: self.logger.error( "Command failed to set next onetime boot to virtual media. " "No virtual optical media boot device." From 9e783a77fba08fa2f634e3447a6eae401bce6df4 Mon Sep 17 00:00:00 2001 From: Gonzalo Rafuls Date: Mon, 18 Sep 2023 12:38:36 +0200 Subject: [PATCH 2/2] test: fixes to custom_interfaces and boot_to --- tests/config.py | 2 ++ tests/test_custom_interfaces.py | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/config.py b/tests/config.py index 993c0f5..f8d385c 100644 --- a/tests/config.py +++ b/tests/config.py @@ -118,6 +118,8 @@ def render_device_dict(index, device): "- INFO - iDRAC will now reset and be back online within a few minutes.\n" "- INFO - Polling for host state: On\n" "- INFO - Command passed to set BIOS attribute pending values.\n" + "- ERROR - POST command failed to create BIOS config job, status code is 400.\n" + "- ERROR - {'JobID': 'JID_498218641680'}\n" ) RESPONSE_BOOT_TO_SERVICE_ERR_HANDLER = ( f"- WARNING - Job queue already cleared for iDRAC {MOCK_HOST}, DELETE command will not execute.\n" diff --git a/tests/test_custom_interfaces.py b/tests/test_custom_interfaces.py index e5c3fd8..76e62fc 100644 --- a/tests/test_custom_interfaces.py +++ b/tests/test_custom_interfaces.py @@ -1,6 +1,7 @@ -from unittest import IsolatedAsyncioTestCase +import pytest from src.badfish.main import Badfish from tests.config import INTERFACES_PATH +from tests.test_base import TestBase E26_EXPECTED_INTERFACES = { "director": "NIC.Slot.3-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1", @@ -23,7 +24,8 @@ } -class TestGetInterfaceByType(IsolatedAsyncioTestCase): +class TestGetInterfaceByType(TestBase): + @pytest.mark.asyncio async def test_get_interface_by_type(self): for host, expected in [ ("mgmt-e26-h01-r750", E26_EXPECTED_INTERFACES),