Change SystemCollection from list to dict

- Change systems_list to systems_dict["<index>"] .
  The systems_dict will contain system objects, <index> is
  the redfish <index> as reported inside url.
This commit is contained in:
Uggla
2016-02-11 22:18:38 +01:00
parent 2bfff304ed
commit a2cafc9802
4 changed files with 30 additions and 31 deletions

View File

@@ -247,8 +247,6 @@ class RedfishConnection(object):
self.connection_parameters
)
#for system in self.Systems.systems_list:
#config.logger.debug(system.data.links.ManagedBy)
# self.Chassis
# self.EventService

View File

@@ -428,11 +428,12 @@ class SystemsCollection(BaseCollection):
'''Class to manage redfish SystemsCollection data.'''
def __init__(self, url, connection_parameters):
super(SystemsCollection, self).__init__(url, connection_parameters)
self.systems_list = []
self.systems_dict = {}
for link in self.links:
self.systems_list.append(Systems(link, connection_parameters))
index = re.search(r'Systems/(\w+)', link)
self.systems_dict[index.group(1)] = Systems(link, connection_parameters)
class Bios(Base):