Hello,
I am currently writing the code for automating our ssl cert deployment among other things. I upload files to the Bigip device to shared/file-transfer/uploads/ This only works when the directory /var/config/rest/downloads/tmp exists. I noticed this periodically is removed again. Is there a way I can run an mkdir over REST to fix this?
Regards
Something like this should work. This basic example is in python, using the requests module and the json module to convert the dict to json.
import requests
import json
s = requests.session()
s.auth = ('admin','admin')
s.verify = False
ip = "some.IP"
url = "/mgmt/tm/util/bash"
payload = { "command":"run",
"utilCmdArgs":"-c 'mkdir /var/config/rest/downloads/tmp'" }
resp = s.post("https://"+ip+url, data=json.dumps(payload))
print resp.text
Returns: {"kind":"tm:util:bash:runstate","utilCmdArgs":"-c 'mkdir /var/config/rest/downloads/tmp'","command":"run","commandResult":"mkdir: cannot create directory `/var/config/rest/downloads/tmp': File exists\n"}
The equivalent command in tmsh would be: run /util bash -c ‘mkdir /var/config/rest/downloads/tmp’
Now I don’t know how well supported this method is or if it will continue to exist, but it works for me.