HewlettPackard / python-ilorest-library

Python library for interacting with devices which support a Redfish Service
Apache License 2.0
189 stars 92 forks source link

redfish.rest.connections.RetriesExhaustedError #82

Closed hassan-ayo closed 4 years ago

hassan-ayo commented 4 years ago

add_ilo_user_account.py works fine with one iLO ip address But when I tried to read many iP from a file , it gives the error : redfish.rest.connections.RetriesExhaustedError .

f = open('ilo_ip.txt', 'r')
ip_add = f.readline()
for x in ip_add:
    SYSTEM_URL = "https://" + str(x)
    LOGIN_ACCOUNT = "admin"
    LOGIN_PASSWORD = "password"

    REST_OBJ = LegacyRestClient(base_url=SYSTEM_URL, username=LOGIN_ACCOUNT, 
                                                        password=LOGIN_PASSWORD)
    REST_OBJ.login()
    sys.stdout.write("\nCreate an iLO User Account\n")
    add_ilo_user_account(REST_OBJ, str(name), str(username), str(password))
    REST_OBJ.logout()

Any idea ?

Yergidy commented 4 years ago

What iLO version are the systems running?

hassan-ayo commented 4 years ago

iLO4

I am using the script from Legacy_Rest folder

Yergidy commented 4 years ago

Looks like you are iterating over the line instead of the IPs in the file (So you are iterating over each character). You need to change how your for loop works. In addition make sure you strip off the trailing '\n' or you will get errors.

hassan-ayo commented 4 years ago

I changed the loop to with open (...) as f: It works fine Thank you for the help