Reference Guide
13 RESTful Server Configuration with iDRAC RESTful API
$ python ./redfish_SCP_get_job_status.py JID_967983367454
- Status code is: 200
- Job ID = JID_967983367454
- Name = Export: Server Configuration Profile
- Message = Successfully exported Server Configuration Profile
- JobStatus = Completed
$
Now we combine and enhance the scripts to perform the SCP export and await completion of the export job:
Script – redfish_SCP_export_cifs.v3.py version 3:
# Python script using Redfish API to perform iDRAC feature
# Server Configuration Profile (SCP) for export only
import requests, json, sys, re, time
from datetime import datetime
try:
idrac_ip = sys.argv[1]
idrac_username = sys.argv[2]
idrac_password = sys.argv[3]
file = sys.argv[4]
except:
print "\n- FAIL, you must pass in script name along with iDRAC IP/iDRAC username/iDRAC paasswo
rd/file name"
sys.exit()
url = 'https://%s/redfish/v1/Managers/iDRAC.Embedded.1/Actions/Oem/EID_674_Manager.ExportSystemCon
figuration' % idrac_ip
# For payload dictionary supported parameters, refer to schema
# "https://'iDRAC IP'/redfish/v1/Managers/iDRAC.Embedded.1/"
payload = {"ExportFormat":"XML","ExportUse":"Default","ShareParameters":{"Target":"LifecycleContro
ller","IPAddress":"192.168.0.130","ShareName":"smb_share","ShareType":"CIFS","FileName":file,"User
Name":"username","Password":"password"}}
headers = {'content-type': 'application/json'}
response = requests.post(url, data=json.dumps(payload), headers=headers, verify=False, auth=(idrac
_username,idrac_password))
d=str(response.__dict__)
try:
z=re.search("JID_.+?,",d).group()
except:
print "\n- FAIL: detailed error message: {0}".format(response.__dict__['_content'])
sys.exit()
job_id=re.sub("[,']","",z)
if response.status_code != 202:
print "\n##### Command Failed, status code not 202\n, code is: %s" % response.status_code
sys.exit()
else: