Skip to content

Commit e27dec8

Browse files
committed
Ruff format
1 parent 849e1e2 commit e27dec8

File tree

3 files changed

+16
-22
lines changed

3 files changed

+16
-22
lines changed

python/ironic-understack/ironic_understack/port_bios_name_hook.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ def __call__(self, task, inventory, plugin_data):
2222
LOG.error("No interfaces in inventory for node %s", task.node.uuid)
2323
return
2424

25-
interface_names = {
26-
i["mac_address"]: i["name"] for i in inspected_interfaces
27-
}
25+
interface_names = {i["mac_address"]: i["name"] for i in inspected_interfaces}
2826

2927
for baremetal_port in ironic_ports_for_node(task.context, task.node.id):
3028
mac = baremetal_port.address

python/ironic-understack/ironic_understack/tests/test_port_bios_name_hook.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,14 @@
44
from ironic_understack.port_bios_name_hook import PortBiosNameHook
55

66
_INVENTORY = {
7-
"memory": {
8-
"physical_mb": 98304
9-
},
7+
"memory": {"physical_mb": 98304},
108
"interfaces": [
11-
{
12-
"mac_address": "11:11:11:11:11:11",
13-
"name": "NIC.Integrated.1-1"
14-
},
15-
{
16-
"mac_address": "22:22:22:22:22:22",
17-
"name": "NIC.Integrated.1-2"
18-
},
19-
],
9+
{"mac_address": "11:11:11:11:11:11", "name": "NIC.Integrated.1-1"},
10+
{"mac_address": "22:22:22:22:22:22", "name": "NIC.Integrated.1-2"},
11+
],
2012
}
2113

14+
2215
def test_adding_bios_name(mocker, caplog):
2316
caplog.set_level(logging.DEBUG)
2417

@@ -29,13 +22,13 @@ def test_adding_bios_name(mocker, caplog):
2922
mock_port = mocker.Mock(
3023
uuid=uuidutils.generate_uuid(),
3124
node_id=node_uuid,
32-
address="11:11:11:11:11:11" ,
25+
address="11:11:11:11:11:11",
3326
extra={},
3427
)
3528

3629
mocker.patch(
3730
"ironic_understack.port_bios_name_hook.ironic_ports_for_node",
38-
return_value=[mock_port]
31+
return_value=[mock_port],
3932
)
4033

4134
PortBiosNameHook().__call__(mock_task, _INVENTORY, {})
@@ -60,7 +53,7 @@ def test_removing_bios_name(mocker, caplog):
6053

6154
mocker.patch(
6255
"ironic_understack.port_bios_name_hook.ironic_ports_for_node",
63-
return_value=[mock_port]
56+
return_value=[mock_port],
6457
)
6558

6659
PortBiosNameHook().__call__(mock_task, _INVENTORY, {})

python/ironic-understack/ironic_understack/tests/test_update_baremetal_port.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,14 @@
5454
}
5555

5656
MAPPING = {
57-
"1": "network", "2": "network",
58-
"1f": "storage", "2f": "storage",
57+
"1": "network",
58+
"2": "network",
59+
"1f": "storage",
60+
"2f": "storage",
5961
"-1d": "bmc",
6062
}
6163

64+
6265
def test_with_valid_data(mocker, caplog):
6366
caplog.set_level(logging.DEBUG)
6467

@@ -77,11 +80,11 @@ def test_with_valid_data(mocker, caplog):
7780

7881
mocker.patch(
7982
"ironic_understack.update_baremetal_port.ironic_ports_for_node",
80-
return_value=[mock_port]
83+
return_value=[mock_port],
8184
)
8285
mocker.patch(
8386
"ironic_understack.update_baremetal_port.CONF.ironic_understack.switch_name_vlan_group_mapping",
84-
MAPPING
87+
MAPPING,
8588
)
8689
mocker.patch("ironic_understack.update_baremetal_port.objects.TraitList.create")
8790

0 commit comments

Comments
 (0)