2016-08-22 126 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