Skip to content

Commit

Permalink
Fix bug that causes expired leases to not be reflected on ironic nodes
Browse files Browse the repository at this point in the history
The ironic_node resource_object automatically popped the lease_uuid
from its properties dict when calling get_config. However, this is
permanently reflected on the resource object, and results in future
queries of the resource object's lease_uuid returning None.
  • Loading branch information
tzumainn committed Jul 13, 2023
1 parent 21490a8 commit b7a3772
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
4 changes: 3 additions & 1 deletion esi_leap/objects/lease.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ def __init__(self, lease, node):
setattr(node, 'node_name', node.get_name())
setattr(node, 'node_provision_state', node.get_node_provision_state())
setattr(node, 'node_power_state', node.get_node_power_state())
setattr(node, 'node_properties', node.get_config())
node_config = node.get_config().copy()
node_config.pop('lease_uuid', None)
setattr(node, 'node_properties', node_config)

self.populate_schema(lease=lease, node=node)

Expand Down
1 change: 0 additions & 1 deletion esi_leap/resource_objects/ironic_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def get_config(self):
config = self._get_node_attr('properties', {},
err_msg='Error getting resource config',
err_val=error.UNKNOWN['config'])
config.pop('lease_uuid', None)
return config

def get_owner_project_id(self):
Expand Down
1 change: 0 additions & 1 deletion esi_leap/tests/resource_objects/test_ironic_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ def test_get_config(self, mock_gn):

config = test_ironic_node.get_config()
expected_config = fake_get_node.properties
expected_config.pop('lease_uuid', None)
self.assertEqual(config, expected_config)
mock_gn.assert_called_once()

Expand Down

0 comments on commit b7a3772

Please sign in to comment.