2016-08-22 134 views
0

我正在使用wslt.sh以聲明方式創建腳本以自動創建JMS資源。這樣我只需要運行wslt.sh create_resources.py planned_resources.properties模塊化python腳本中的Weblogic WSLT

create_resources.py導入我的另一個模塊import include.jms as nmjms。這包括WSLT的/ jms.py調用cdcmo

的問題是,調用cd不改變cmo的狀態jms.py模塊中,使我不能cd調用後cmo執行上下文相關的指令。這是frustating ...

回答

1

首先,創建一個模塊wl.py與如下因素代碼:你jms.py模塊中

# Caution: This file is part of the command scripting implementation. 
# Do not edit or move this file because this may cause commands and scripts to fail. 
# Do not try to reuse the logic in this file or keep copies of this file because this 
# could cause your scripts to fail when you upgrade to a different version. 
# Copyright (c) 2004,2014, Oracle and/or its affiliates. All rights reserved. 

""" 
This is WLST Module that a user can import into other Jython Modules 

""" 
from weblogic.management.scripting.utils import WLSTUtil 
import sys 
origPrompt = sys.ps1 
theInterpreter = WLSTUtil.ensureInterpreter(); 
WLSTUtil.ensureWLCtx(theInterpreter) 
execfile(WLSTUtil.getWLSTCoreScriptPath()) 
execfile(WLSTUtil.getWLSTNMScriptPath()) 
execfile(WLSTUtil.getWLSTScriptPath()) 
execfile(WLSTUtil.getOfflineWLSTScriptPath()) 
exec(WLSTUtil.getOfflineWLSTScriptForModule()) 
execfile(WLSTUtil.getWLSTCommonModulePath()) 
theInterpreter = None 
sys.ps1 = origPrompt 
modules = WLSTUtil.getWLSTModules() 
for mods in modules: 
    execfile(mods.getAbsolutePath()) 
jmodules = WLSTUtil.getWLSTJarModules() 
for jmods in jmodules: 
    fis = jmods.openStream() 
    execfile(fis, jmods.getFile()) 
    fis.close() 
wlstPrompt = "false" 

接下來,導入這個模塊並調用這樣的WLST命令:WL。 cd('...')

+0

你救了我的一天!對於我的情況應該是http://northernserve.ca/downloads/Oracle/Middleware/wlserver_10.3/common/wlst/modules/wlstModule.py – sancho21