try/catch when creating a wlst deployment session....
655092May 19 2009 — edited May 20 2009in the DspCommonCommands.py there is a definition similar to (sorry the spaces don't translate well here):
Line: -----
def createDeploymentSession(sessionName):
moveToDomainServiceMBean()
wlst.invoke("createDeploymentSession",[sessionName],["java.lang.String"])
moveToDeploymentSessionMBean(sessionName)
Line: -----
If my deployment script fails and someone tries to rerun it, there may be a session left out there. So, I want to do something very simple to catch the exception and do something with it.
As a start, I changed the above code to:
Line: -----
def createDeploymentSession(sessionName):
moveToDomainServiceMBean()
try:
wlst.invoke("createDeploymentSession",[sessionName],["java.lang.String"])
except :
print "DISCARDING OLD SESSION WITH THE SAME NAME..."
discardDeploymentSession(sessionName)
wlst.invoke("createDeploymentSession",[sessionName],["java.lang.String"])
moveToDeploymentSessionMBean(sessionName)
Line: -----
Now, the script discards the old session and continues on its merry way, but the output still includes the trace of the original error.
How can I "hide" the stack trace of the error and let the script continue on its way?