Is there a way to call specific functions in a jython script through the wsadmin program?
# BusAndBusMemeber.py
def devCreateBus:
AdminTask.createSIBus('[-bus intjmsbus -description [SIBus intjmsbus] -busSecurity false]')
AdminTask.addSIBusMember('[-bus intjmsbus -node ctgNode01 -server MXServer]')
AdminConfig.save()
def devDeleteBus:
AdminTask.deleteSIBus('[-bus intjmsbus]')
AdminConfig.save()
from server cmd prompt:
C:\IBM\WebSphere....\bin> wsadmin -conntype SOAP -user myUsername -password myPassword -lang jython -f BusAndBusMember.py devCreateBus
Or
C:\IBM\WebSphere....\bin> wsadmin -conntype SOAP -user myUsername -password myPassword -lang jython -f BusAndBusMember.py [devCreateBus]
so far the only way I've been able to execute the jython script is by simply scripting out the AdminTasks.
thanks.
It is a bit of a hack but you can append this to your script:
globals()[sys.argv[0]]()
An alternative is to keep your functions in this file and write a second python script that does the logic of which functions to call:
import sys
execfile("BusAndBusMemeber.py")
if sys.argv[0] == "devCreateBus":
devCreateBus();
else:
print("Unknown arg %s" % sys.argv[0])