2

我的代码如下:

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 等,并在 selection 上重新部署应用程序。请帮我将输出分配给一个变量以供选择。

4

1 回答 1

0

这是你要找的东西吗?

for app in apps:
        vars()[str(app)] = AdminControl.getAttribute(app, 'name')

现在,如果名称appTradeWeb_war

呼叫,TradeWeb_war将为您提供以下价值:

AdminControl.getAttribute(TradeWeb_war, 'name')
于 2013-06-17T00:47:15.247 回答