Skip to content

Commit

Permalink
Merge pull request #331 from xlab-si/fix/physical-servers-kwargs
Browse files Browse the repository at this point in the history
[RFR] Refactor physical server stat calls
  • Loading branch information
izapolsk authored Oct 5, 2018
2 parents 076eee2 + a06f19d commit b238999
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions wrapanapi/systems/lenovo.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,23 +348,31 @@ def set_server_led_blinking(self, server_name):

return "LED state action has been sent, status:" + str(response.status_code)

def server_stats(self, *requested_stats, **kwargs):
# Get the requester which represents the class of this method's caller
requester = kwargs.get('requester')

def server_stats(self, physical_server, requested_stats, **kwargs):
"""
Obtain the means to compute the requested physical server statistics.
Args:
physical_server: representation for the class of this method's caller
requested_stats: the statistics to be obtained
"""
# Retrieve and return the stats
requested_stats = requested_stats or self._stats_available

return {stat: self._server_stats_available[stat](self, requester)
return {stat: self._server_stats_available[stat](self, physical_server)
for stat in requested_stats}

def server_inventory(self, *requested_items, **kwargs):
# Get the requester which represents the class of this method's caller
requester = kwargs.get('requester')
def server_inventory(self, physical_server, requested_items, **kwargs):
"""
Obtain the means to compute the requested physical server inventory.
Args:
physical_server: representation for the class of this method's caller
requested_items: the inventory items to be obtained for the server
"""
# Retrieve and return the inventory
requested_items = requested_items or self._server_inventory_available
return {item: self._server_inventory_available[item](self, requester)
return {item: self._server_inventory_available[item](self, physical_server)
for item in requested_items}

def get_network_devices(self, server_name):
Expand Down

0 comments on commit b238999

Please sign in to comment.