Python IBMWebSphere:如何使用wsadmin脚本将应用程序映射到多个集群?

Python IBMWebSphere:如何使用wsadmin脚本将应用程序映射到多个集群?,python,websphere,jython,websphere-8,wsadmin,Python,Websphere,Jython,Websphere 8,Wsadmin,我正在尝试使用wsadmin脚本将映射到单元中两个集群的应用程序的部署自动化。但无论我怎么尝试,应用程序都只映射到一个集群。因此,应用程序根本没有启动 我收到以下错误消息: Application helloteam_07062019_1956 is not deployed on the cluster SPPAbcd Exception: exceptions.AttributeError WASL6048E: The helloteam_07062019_1956 application

我正在尝试使用wsadmin脚本将映射到单元中两个集群的应用程序的部署自动化。但无论我怎么尝试,应用程序都只映射到一个集群。因此,应用程序根本没有启动

我收到以下错误消息:

Application helloteam_07062019_1956 is not deployed on the cluster SPPAbcd
Exception: exceptions.AttributeError WASL6048E: The helloteam_07062019_1956 application is not deployed on the SPPAbcd target.  
WASX7017E: Exception received while running file "/app/was_scripts/main_scripts/deploy_mutlitest.py"; exception information: com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
  File "<string>", line 175, in ?
  File "/app/service/IBM/WebSphere/AppServer/scriptLibraries/application/V70/AdminApplication.py", line 4665, in startApplicationOnCluster
ScriptLibraryException: : 'exceptions.AttributeError WASL6048E: The helloteam_07062019_1956 application is not deployed on the SPPAbcd target. '
如上所述,无论我尝试什么,应用程序都只会映射到SRVApp集群(在DMGR控制台中检查应用程序的管理模块部分之后)。未将其映射到群集

如何实现到多集群的适当模块映射?模块映射部分在
adminapp.install
命令中提到。这是映射模块的正确方法吗

提前表示感谢和问候


-Kris

为了解决这个问题,我利用Jenkins的EnvInject插件在构建时注入属性

我没有使用两个targetServers(targetServerOne和targetServerTwo),而是只使用了目标服务器,并从属性文件中调用了它

这是我的属性文件:

moduleMapping=WebSphere:cell=cell1,cluster=cluster1+WebSphere:cell=cell1,cluster=cluster2
我的脚本已修改如下:

from os import getenv as env

targetServer = env(‘moduleMapping’)

AdminApp.install(filename, [ ‘-MapModulesToServers, [[‘moduleName’, ‘uri’, targetServer]]])

这已将我的应用程序映射到一个单元格中的两个群集

我会做一个循环并调用install两次。不是说不可能,只是一个建议。我从来没有在同一个单元的两个集群中部署过同一个应用程序。@Nic3500我已经解决了这个问题。请看下面我的答案:)
from os import getenv as env

targetServer = env(‘moduleMapping’)

AdminApp.install(filename, [ ‘-MapModulesToServers, [[‘moduleName’, ‘uri’, targetServer]]])