'--password', dest='ilo_pass', action="store", help="iLO password to log in.", default=None) options = parser.parse_args() system_url = "https://" + options.ilo_ip print (system_url) # flag to force disable resource directory. Resource directory and associated operations are # intended for HPE servers. DISABLE_RESOURCE_DIR = False try: # Create a Redfish client object redfish_obj = RedfishClient(base_url=system_url, username=options.ilo_user, password=options.ilo_pass) # Login with the Redfish client redfish_obj.login() except ServerDownOrUnreachableError as excp: sys.stderr.write("ERROR: server not reachable or does not support RedFish.\n") sys.exit() (ilogen,_) = get_gen(redfish_obj) print ("Generation is ", ilogen) if int(ilogen) == 5: get_SmartArray_LogicalDrives(redfish_obj) else: get_SmartArray_LogicalDrives_gen9(redfish_obj) redfish_obj.logout()
"HostStorageConfigPriv": True, "HostNICConfigPriv": True, \ "HostBIOSConfigPriv": True} # flag to force disable resource directory. Resource directory and associated operations are # intended for HPE servers. DISABLE_RESOURCE_DIR = False try: # Create a Redfish client object REDFISHOBJ = RedfishClient(base_url=SYSTEM_URL, username=LOGIN_ACCOUNT, \ password=LOGIN_PASSWORD) # Login with the Redfish client REDFISHOBJ.login() except ServerDownOrUnreachableError as excp: sys.stderr.write("ERROR: server not reachable or does not support RedFish.\n") sys.exit() #obtain all account instances, by navigating set paths and keys to find the relevant URI #(account_collection_uri, accounts, rd) = get_accounts(redfishobj, DISABLE_RESOURCE_DIR) #print("\n\nShowing accounts before changes:\n\n") #show_accounts(redfishobj, accounts) #if account_collection_uri and accounts: #add specified account (ilogen,_) = get_gen(REDFISHOBJ) print ("Generation is ", ilogen) if int(ilogen) == 5: add_ilo_user_account(REDFISHOBJ,ACCOUNT_LOGIN_NAME,ACCOUNT_USER_NAME,ACCOUNT_PASSWORD,ROLE_ID,PRIVILEGE_DICT) else: add_ilo_user_account_gen9(REDFISHOBJ,ACCOUNT_LOGIN_NAME,ACCOUNT_USER_NAME,ACCOUNT_PASSWORD) REDFISHOBJ.logout()