2016-08-22 9 views
0

Я создаю скрипт для автоматического создания ресурсов JMS декларативным способом с использованием wslt.sh. Таким образом, мне просто нужно запустить wslt.sh create_resources.py planned_resources.propertiesWeblogic WSLT в модульном скрипте python

create_resources.py импортирует еще один мой модуль import include.jms as nmjms. Сюда входят/jms.py вызовы cd и cmo WSLT.

Проблема заключается в том, вызывая cd не изменяет состояние cmo в модуле jms.py, так что я не могу выполнять команды, связанные контекстных на cmo после cd вызова. Это frustating ...

ответ

1

Во-первых, создать модуль wl.py с кодом: folowing

# 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" 

Далее, импорт этого модуля в модуле jms.py и вызвать WLST команды, как этот: WL. cd ('...')

+0

Вы спасли мой день! Для моего случая это должно быть http://northernserve.ca/downloads/Oracle/Middleware/wlserver_10.3/common/wlst/modules/wlstModule.py – sancho21

 Смежные вопросы

  • Нет связанных вопросов^_^