Fix to handle Redfish v1.0 session login.

This commit is contained in:
Uggla 2015-09-23 23:52:11 +02:00
parent 6b2728e5d8
commit a3755a1071

View File

@ -11,6 +11,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from redfish import mapping
"""
STARTING ASSUMPTIONS
@ -285,6 +286,11 @@ class RedfishConnection(object):
url = self.Root.get_link_url(
mapping.redfish_mapper.map_sessionservice()
)
# 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'
# Craft request body and header
requestBody = {"UserName": self.connection_parameters.user_name , "Password": self.connection_parameters.password}