Forum Discussion
IRULE for HTTP HEADER STRING find and replace
- Jul 03, 2014
Hi,
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] contains "abc" } { set uri [string map -nocase {"abc" "xyz"} [HTTP::uri]] HTTP::uri $uri } }
Hi Tim,
try these Postman settings...
Request Settings:
Method: POST
URL: https://YOURBOX/mgmt/tm/util/bash
Authorization: BasicAuth = YourCredentials
Headers: Content-Type = application/json
Body: {"command":"run","utilCmdArgs":"-c 'echo \"Hello World\"'"}
Note: You can also set the Content-Type on Postmans "Body" pane. Click on the down arrow to see the predifined JSON setting...
Expected Result:
{
"kind": "tm:util:bash:runstate",
"command": "run",
"utilCmdArgs": "-c 'echo \"Hello World\"'",
"commandResult": "Hello World\n"
}
Cheers, Kai
- Nik_SheridanFeb 12, 2020
Altostratus
If you are having a problem using this module, once you have instantiated object 't' in the example I found it useful to set the debug attribute to True as this allows for feedback on the installAS3 method when it's called e.g.:
>>> t.debug=True >>> t.installAS3(host='BIGIP',username='SOME_USER',password='SOME_PASSWORD',filename='f5-appsvcs-3.17.1-1.noarch.rpm') DEBUG: Filename f5-appsvcs-3.17.1-1.noarch.rpm specified, uploading to host BIGIP DEBUG: Uploading file f5-appsvcs-3.17.1-1.noarch.rpm DEBUG: Installing package f5-appsvcs-3.17.1-1.noarch.rpm from /var/config/rest/downloads DEBUG: Created task to install package f5-appsvcs-3.17.1-1.noarch.rpm DEBUG: Waiting for 5 secs DEBUG: Checking whether the package is installed DEBUG: Response from /mgmt/shared/appsvcs/info False False >>>
I also found in the imports in the module itself, that on my system (and I did do this in a virtual environment as well), I needed to amend the import statements as follows
#replaced import iCR from iCR import iCR
I found when I used it, that the module was not referring to the iCR class correctly, and it needed the above in order to work without throwing an exception regarding the module not being callable.
HTH but still got a couple of snags left 😞 but looks very, very, useful when working so I am persevering with this. (note I am using python3.6.0)
If this is open sourced I can try and make this work on my system and submit a pull request with more detail if that is helpful.