-
Notifications
You must be signed in to change notification settings - Fork 5
/
export_scp.py
39 lines (22 loc) · 1.02 KB
/
export_scp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import os, requests, json,re
requests.packages.urllib3.disable_warnings()
#idrac_ip = "100.98.26.37";
idrac_ip= os.environ['IDRAC_IP']
#share_ip = "100.98.26.42";
share_ip= os.environ['NFS_SERVER']
#share_name = "/var/nfsshare";
share_name = os.environ['NFS_SERVER_SHARE']
#file_name = "R730_myxmlSCP.xml";
file_name = os.environ['CONFIG_FILE']
url = 'https://'+ idrac_ip +'/redfish/v1/Managers/iDRAC.Embedded.1/Actions/Oem/EID_674_Manager.ExportSystemConfiguration'
payload = {"ExportFormat":"XML","ShareParameters":{"Target":"ALL","IPAddress": share_ip,"ShareName":share_name,"ShareType":"NFS","FileName":file_name}}
headers = {'content-type': 'application/json'}
response = requests.post(url, data=json.dumps(payload), headers=headers, verify=False,
auth=('root','calvin'))
print '- Response status code is: %s' % response.status_code
response_output=response.__dict__
print response_output
#job details
job_id=response_output["headers"]["Location"]
job_id=re.search("JID_.+",job_id).group()
print "- Job ID is: %s" % job_id