This one is quite simple, here’s a script to list all the persistent file stores from a weblogic using WLST. With ls() you can list all the tree and get an property from it using get().
How to use this script:
<MIDDLEWARE_HOME>/soa/common/bin/wlst.sh bring_datasources.py <ENV> <DOMAIN>
#miguel.ortiz
import sys,os,re
environment = sys.argv[1]
domain = sys.argv[2]
hostUser = 'READONLY_USER'
hostPass = 'readonly_pass'
# you need to provide two parameters, environment and domain
if environment == '' or domain == '' :
print 'este script requiere (2) parametros, Ambiente y Dominio'
# if the environment is QAM
if environment == 'QAM' :
hostIP = '172.x.x.x'
if domain == 'SYNC':
hostPort = '8001'
fsPath = '/f1/stores/filestore/SYNC/'
if domain == 'ASYNC':
hostPort = '8002'
fsPath = '/f1/stores/filestore/ASYNC/'
if domain == 'RSYNC':
hostPort = '8003'
fsPath = '/f1/stores/filestore/RSYNC/'
# If my environment is Production
if environment == 'PROD' :
hostIP = '172.x.x.x'
if domain == 'SYNC':
hostPort = '8001'
fsPath = '/d1/stores/filestore/SYNC/'
if domain == 'ASYNC':
hostPort = '8002'
fsPath = '/d1/stores/filestore/ASYNC/'
if domain == 'RSYNC':
hostPort = '8003'
fsPath = '/d1/stores/filestore/RSYNC/'
# Connect to the host
connect( hostUser , hostPass , 't3://' + hostIP + ':' + hostPort )
# redirect the stdout to get a clean output
redirect('file','false')
fileStore = ls('FileStores')
fileStore = fileStore.replace('dr--','')
listFileStores = fileStore.split()
for fsName in listFileStores :
fileStoreName = get('FileStores/' + fsName + '/Name')
stopRedirect()
print str(fileStoreName) +';' + str(fsPath)