I'm maintaining a build that is interrupted when trying to delete missing MDS partition.
It's fine when there's stuff to remove.
I'm not so familiar with the subject and I'd like to either
- check partition presence before removal
- handle error and continue maven life-cycle
pom part in question is
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>delete-MDS</id>
<phase>pre-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${oracle.wlst}</executable>
<arguments>
<argument>${predeploy.script.deletemds}</argument>
<argument>weblogic</argument>
<argument>${adminServerPassword}</argument>
<argument>${adminServerUrl}</argument>
<argument>${mds.repository}</argument>
<argument>${mds.partition}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
${predeploy.script.deletemds} content is
print '\nStarting deleteMDSOnDomain.py'
#skipped mapping input to variables here
try:
connect(username,password,url)
print "Deleting MDS configuration"
#fails if partition already removed
deleteMetadataPartition( repository=mdsRepository, partition=mdsPartition)
except Exception, e:
print e
print "Error while trying to delete MDS configuration"
dumpStack()
#raise
print 'Finished deleteMDSOnDomain.py\n'
When running it I get
...
[INFO] Deleting MDS configuration
[INFO] Location changed to domainRuntime tree. This is a read-only tree with DomainMBean as the root.
[INFO] For more help, use help(domainRuntime)
[INFO]
[INFO]
[INFO] Problem invoking WLST - Traceback (innermost last):
[INFO] File "C:\Dev\trunk\<App>\<Project>\scripts\deleteMDSOnDomain.py", line 24, in ?
[INFO] File "C:\Dev\Oracle\MIDDLE~1\ORACLE~1\common\wlst\mdsWLSTCommands.py", line 471, in deleteMetadataPartition
[INFO] File "C:\Dev\Oracle\MIDDLE~1\ORACLE~1\common\wlst\mdsWLSTCommands.py", line 836, in executeDomainRuntimeMBeanOperation
[INFO] File "C:\Dev\Oracle\MIDDLE~1\ORACLE~1\common\wlst\mdsWLSTCommands.py", line 1097, in saveStackAndRaiseException
[INFO] WLSTException: MDS-00555: The partitionName <App> is invalid.
[INFO] ORA-01403: no data found
[INFO] ORA-06512: at "<env>_MDS.MDS_INTERNAL_SHREDDED", line 580
[INFO] ORA-06512: at line 1
[INFO] MDS-91009: Operation "deleteMetadataPartition" failure. Use dumpStack() to view the full stacktrace.
[INFO]
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Result of cmd.exe /X /C "C:\Dev\Oracle\Middleware\oracle_common\common\bin\wlst.cmd scripts/deleteMDSOnDomain.py weblogic <pass> <url> mds-CustomPortalDS <App>" execution is: '1'.
[INFO] ------------------------------------------------------------------------
It appears that wlst result "1" is propagated to maven, e.g. my py catch isn't fully handling that - can I manually change it to "0, ok" there?
Edit: typos
All is caught fine. The error is raised by another plugin that attempts to undeploy the application next. Just realized it after noticing
[INFO] [Deployer:149001]No application named '<app>' exists for operation undeploy.
I could swear it wasn't there before ... Anyway I got some code to check for partition existence in the answer below too.