From 30565317cc173cd0dfe38113c4141121c288cea5 Mon Sep 17 00:00:00 2001 From: Uggla Date: Sun, 20 Mar 2016 19:01:51 +0100 Subject: [PATCH] Fix invalid login using redfish url. - Login using https:///redfish/v1 raised an error, which was not the case using https:///rest/v1. This was due to a '/' appended to the Sessions url ending to a '//' in the target url. Fix by using urlparse.urljoin to fix that issue. --- redfish/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/redfish/main.py b/redfish/main.py index bf96712..9b69d1b 100644 --- a/redfish/main.py +++ b/redfish/main.py @@ -127,7 +127,7 @@ from builtins import object import json -from urllib.parse import urlparse +from urllib.parse import urlparse, urljoin import requests from . import config from . import types @@ -289,7 +289,7 @@ class RedfishConnection(object): # Handle login with redfish 1.00, url must be : # /rest/v1/SessionService/Sessions as specified by the specification if float(mapping.redfish_version) >= 1.00: - url += '/Sessions' + url = urljoin(url, "Sessions") # Craft request body and header requestBody = {"UserName": self.connection_parameters.user_name , "Password": self.connection_parameters.password}