Search code examples
weblogic12cwlst

WLST writeDomain fails because directory is not empty


I am in the process of rewriting a former weblogic installer script (bash/wlst mix) to ansible

I templated the following wlst snippet to create the domain. wlst runs with python2.7 It expects the target directory to be empty. But at one point the script itself populates the directory with servers/AdminServer subdirs. I think it is the command

cd('Servers/AdminServer')

The complete snippet is (with my debugging cmds)

import os
d="/srv/wlp/domains/aserver/wlp_domain_test"
fn="/home/svuser/wlst.log"
f=file(fn,"w")
f.write(str(os.listdir(d)))

print ('Loading domain template')
selectTemplate('Basic WebLogic Server Domain')
loadTemplates()

print('Setting admin server name, listen address and port')
cd('Servers/AdminServer')
f.write(str(os.listdir(d)))
cmo.setName('AdminServer')
cmo.setListenAddress('my.domain.de')
cmo.setListenPort(10100)

print('Setting administrator password')
cd('/Security/base_domain/User/weblogic')
cmo.setPassword('XXX')

print('Setting production mode')
setOption('ServerStartMode','prod')

print('Writing new domain to /srv/eip/domains/aserver/eip_domain_test')
writeDomain('/srv/eip/domains/aserver/eip_domain_test')
closeTemplate()
exit()

Sometimes this works, sometimes not. If not then the first file logging shows directory is still empty. and the second one show it has the mentioned content

So i am kind of stuck, what can i do? The snippet is the original one and I definitely want to understand how weblogic domain creation works.


Solution

  • From former runs of the ansible script I still had some weblogic process running, which apparently recreated the subdirectories after a certain amount of time. It always seemed to me they get recreated while running my current ansible script / the wlst script.