I want to run the undeploy only if the application already deployed, if there is no application I'm looking for, I want to pass this part. I think I can do this by first making a list of all applications and then using an if else block if the application exist I'm looking for in this list. But how can I combine WLST and Python for that matter? At the same time, if an error occurs during undeploy, I want to print this error in the exception section.
Edit: "I am getting the applicationName parameter from another file. You can also use this parameter.
And as far as I researched, I can find the deployed application list as follows:
listAppDeployments = cmo.getAppDeployments()
So if applicationName is in listAppDeployments then undeploy should work, otherwise I want to skip this function but I couldn't merge it."
def undeploy() :
try:
conn()
edit()
startEdit()
print 'Something here...'
stopApplication(applicationName)
print 'Something here...'
print 'Something here...'
undeploy(applicationName)
print 'Something here...'
save()
activate()
except:
print 'Something here...'
Thanks.