From 9e20fd158b5a8a2aaa2b05e8ca04f3135494cb67 Mon Sep 17 00:00:00 2001
From: Bruno Cornec <bruno@victoria.frmug.org>
Date: Fri, 7 Jun 2019 02:29:06 +0200
Subject: [PATCH] Gen-Z support

Fix for Gen-Z simulator which doesn't provide the SessionService entrypoint

Change-Id: I3b17c9db8c12605cd70c1034bbb138743325dbd1
---
 redfish/main.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/redfish/main.py b/redfish/main.py
index 562c151..20af189 100644
--- a/redfish/main.py
+++ b/redfish/main.py
@@ -237,10 +237,14 @@ class RedfishConnection(object):
         # ===================================================================
 
         # standard
-        self.SessionService = standard.SessionService(
-            self.Root.get_link_url(
-                mapping.redfish_mapper.map_sessionservice()),
-            self.connection_parameters)
+        # Gen-Z simulator has no SessionService for now so handle this case
+        try:
+            self.SessionService = standard.SessionService(
+                self.Root.get_link_url(
+                    mapping.redfish_mapper.map_sessionservice()),
+                self.connection_parameters)
+        except AttributeError:
+            self.SessionService = None
 
         # Moonshot m510 cartridge has neither Managers nor Chassis, so handle
         # this case in the code.