Skip to content

Commit

Permalink
Add state fields to node controller
Browse files Browse the repository at this point in the history
When displaying node information, it's often useful to be able to
see the node's provisioning state and maintenance info.
  • Loading branch information
tzumainn committed Aug 19, 2022
1 parent f0dfebe commit e4226ee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion esi_leap/api/controllers/v1/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class Node(base.ESILEAPBase):

name = wsme.wsattr(wtypes.text)
owner = wsme.wsattr(wtypes.text)
maintenance = wsme.wsattr(wtypes.text)
provision_state = wsme.wsattr(wtypes.text)
uuid = wsme.wsattr(wtypes.text)
offer_uuid = wsme.wsattr(wtypes.text)
lease_uuid = wsme.wsattr(wtypes.text)
Expand All @@ -42,7 +44,8 @@ class Node(base.ESILEAPBase):

def __init__(self, **kwargs):
self.fields = ('name', 'owner', 'uuid', 'offer_uuid', 'lease_uuid',
'lessee', 'future_offers', 'future_leases')
'lessee', 'future_offers', 'future_leases',
'provision_state', 'maintenance')
for field in self.fields:
setattr(self, field, kwargs.get(field, wtypes.Unset))

Expand Down Expand Up @@ -91,6 +94,8 @@ def get_all(self):
if lease.resource_uuid == node.uuid])

n = Node(name=node.name, uuid=node.uuid,
provision_state=node.provision_state,
maintenance=str(node.maintenance),
owner=keystone.get_project_name(node.owner, project_list),
lessee=keystone.get_project_name(node.lessee,
project_list),
Expand Down
2 changes: 2 additions & 0 deletions esi_leap/tests/api/controllers/v1/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ def __init__(self):
self.uuid = 'fake-uuid'
self.properties = {'lease_uuid': 'fake-lease-uuid'}
self.lessee = 'fake-project-uuid'
self.maintenance = False
self.provision_state = 'active'


class FakeProject(object):
Expand Down

0 comments on commit e4226ee

Please sign in to comment.