Skip to content

Commit 982f2b8

Browse files
committed
Fixed error using urllib3 1.25
Updated ex48_set_bios_password
1 parent 410abcb commit 982f2b8

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

examples/Redfish/ex48_set_bios_password.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,26 @@
1919
def ex48_set_bios_password(redfishobj, new_password, bios_password=None):
2020
sys.stdout.write("\nEXAMPLE 48: Set Bios Password\n")
2121
instances = redfishobj.search_for_type("Bios.")
22+
2223
if not len(instances) and redfishobj.typepath.defs.isgen9:
2324
sys.stderr.write("\nNOTE: This example requires the Redfish schema "\
24-
"version TBD in the managed iLO. It will fail against iLOs"\
25-
" with the 2.50 firmware or earlier. \n")
26-
27-
for instance in instances:
28-
body = {"AdminPassword": new_password, \
29-
"OldAdminPassword": bios_password}
30-
response = redfishobj.redfish_patch(instance["@odata.id"], body, \
31-
optionalpassword=bios_password)
32-
redfishobj.error_handler(response)
25+
"version TBD in the managed iLO. It will fail against iLO's"\
26+
" with the 2.50 firmware or earlier. \n")
27+
else:
28+
for instance in instances:
29+
response = redfishobj.redfish_get(instance["@odata.id"])
30+
body = dict()
31+
try:
32+
body["PasswordName"] = "Administrator"
33+
body["OldPassword"] = bios_password
34+
body["NewPassword"] = new_password
35+
response = redfishobj.redfish_post(response.dict["Actions"]\
36+
["#Bios.ChangePassword"]\
37+
["target"], body)
38+
except KeyError:
39+
pass
40+
41+
redfishobj.error_handler(response)
3342

3443
if __name__ == "__main__":
3544
# When running on the server locally use the following commented values

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from setuptools import setup, find_packages
22

33
setup(name='python-ilorest-library',
4-
version='2.4.1',
4+
version='2.4.2',
55
description='iLO Rest Python Library',
66
author = 'Hewlett Packard Enterprise',
77
author_email = 'kocurek@hpe.com',

src/redfish/rest/v1.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,8 @@ def __init_connection(self, url=None, proxy=False):
464464
"""
465465

466466
self.__url = url if url else self.__url
467-
http = ProxyManager(self.get_proxy()) if self.get_proxy()\
468-
and proxy else urllib3.PoolManager()
467+
http = ProxyManager(self.get_proxy(), cert_reqs='CERT_NONE') if self.get_proxy()\
468+
and proxy else urllib3.PoolManager(cert_reqs='CERT_NONE')
469469
self._conn = http.request
470470

471471
def __destroy_connection(self):

0 commit comments

Comments
 (0)