我的代码如下:
import java.lang.System as sys
from time import strftime
cells = AdminConfig.list('Cell').split(lineSeparator)
for cell in cells:
nodes = AdminConfig.list('Node', cell).split(lineSeparator)
for node in nodes:
cname = AdminConfig.showAttribute(cell, 'name')
nname = AdminConfig.showAttribute(node, 'name')
servs = AdminControl.queryNames('type=Server,cell=' + cname + ',node=' + nname + ',*').split(lineSeparator)
if servs != ['']:
for server in servs:
sname = AdminControl.getAttribute(server, 'name')
ptype = AdminControl.getAttribute(server, 'processType')
pid = AdminControl.getAttribute(server, 'pid')
state = AdminControl.getAttribute(server, 'state')
apps = AdminControl.queryNames('type=Application,cell=' + cname + ',node=' + nname + ',process=' + sname + ',*').split(lineSeparator)
if ( apps != [''] and sname != 'dmgr' ):
for app in apps:
aname = AdminControl.getAttribute(app, 'name')
print aname
我的要求是列出以下应用程序名称。
wsadmin>execfile('C:/IBM/pyscripts/applist.py')
TradeWeb_war
ibmasyncrsp
所以在这里我想将应用程序列为1,2,3等,并在选择时重新部署应用程序。请帮我将输出分配给变量进行选择。
答案 0 :(得分:0)
这是你要找的东西吗?
for app in apps:
vars()[str(app)] = AdminControl.getAttribute(app, 'name')
现在,如果app
的名称为TradeWeb_war
:
Callling,TradeWeb_war
将为您提供以下值:
AdminControl.getAttribute(TradeWeb_war, 'name')