在 WAS wsadmin 的 AdminApp.update() 函数中使用变量

Use variable in AdminApp.update() function in WAS wsadmin

我无法在 AdminApp.update() 函数中使用包含 sys.argv[0](EAR 文件名)

值的字符串变量

我试过使用 %s 然后在末尾添加 %(APP_NAME) 但它不起作用。

我想在这里使用变量:

/installableApps/VARIABLE_I_PASS_FROM_COMMAND

命令如下:

/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/bin/wsadmin.sh -lang jython -username wasadmin -password ********** -f /root/subidasPRE/Sample/subidaBatchSample.py Sample-Batch.ear

这是代码:

import sys
APP_NAME  =  sys.argv[0]
AdminApp.update('SampleEAR', 'app', '[ -operation update -contents /installableApps/%s -nopreCompileJSPs -installed.ear.destination $(APP_INSTALL_ROOT)/myCellCell01 -distributeApp -nouseMetaDataFromBinary -nodeployejb -nocreateMBeansForResources -noreloadEnabled -nodeployws -validateinstall warn -noprocessEmbeddedConfig -filepermission .*\.dll=755#.*\.so=755#.*\.a=755#.*\.sl=755 -noallowDispatchRemoteInclude -noallowServiceRemoteInclude -asyncRequestDispatchType DISABLED -nouseAutoLink -noenableClientModule -clientMode isolated -novalidateSchema -MapModulesToServers [[ SampleEAREJB SampleEAREJB.jar,META-INF/ejb-jar.xml WebSphere:cell=myCellCell01,cluster=BatchSampleEAR+WebSphere:cell=myCellCell01,node=centurionNode01,server=webpreint443 ][ SampleEAREJB_PER SampleEAREJB_PER.jar,META-INF/ejb-jar.xml WebSphere:cell=myCellCell01,cluster=BatchSampleEAR+WebSphere:cell=myCellCell01,node=centurionNode01,server=webpreint443 ][ SampleEAREJB_SIN SampleEAREJB_SIN.jar,META-INF/ejb-jar.xml WebSphere:cell=myCellCell01,cluster=BatchSampleEAR+WebSphere:cell=myCellCell01,node=centurionNode01,server=webpreint443 ][ SampleEAREJB_PRO SampleEAREJB_PRO.jar,META-INF/ejb-jar.xml WebSphere:cell=myCellCell01,cluster=BatchSampleEAR+WebSphere:cell=myCellCell01,node=centurionNode01,server=webpreint443 ][ SampleEAREJB_COM SampleEAREJB_COM.jar,META-INF/ejb-jar.xml WebSphere:cell=myCellCell01,cluster=BatchSampleEAR+WebSphere:cell=myCellCell01,node=centurionNode01,server=webpreint443 ][ SampleEAREJB_CTR SampleEAREJB_CTR.jar,META-INF/ejb-jar.xml WebSphere:cell=myCellCell01,cluster=BatchSampleEAR+WebSphere:cell=myCellCell01,node=centurionNode01,server=webpreint443 ][ SampleEAREJB_TGEN SampleEAREJB_TGEN.jar,META-INF/ejb-jar.xml WebSphere:cell=myCellCell01,cluster=BatchSampleEAR+WebSphere:cell=myCellCell01,node=centurionNode01,server=webpreint443 ][ SampleEAREJB_DOC SampleEAREJB_DOC.jar,META-INF/ejb-jar.xml WebSphere:cell=myCellCell01,cluster=BatchSampleEAR+WebSphere:cell=myCellCell01,node=centurionNode01,server=webpreint443 ][ SampleEAREJB_CTB SampleEAREJB_CTB.jar,META-INF/ejb-jar.xml WebSphere:cell=myCellCell01,cluster=BatchSampleEAR+WebSphere:cell=myCellCell01,node=centurionNode01,server=webpreint443 ][ SampleEAREJB_RIE SampleEAREJB_RIE.jar,META-INF/ejb-jar.xml WebSphere:cell=myCellCell01,cluster=BatchSampleEAR+WebSphere:cell=myCellCell01,node=centurionNode01,server=webpreint443 ][ SampleEAREJB_REC SampleEAREJB_REC.jar,META-INF/ejb-jar.xml WebSphere:cell=myCellCell01,cluster=BatchSampleEAR+WebSphere:cell=myCellCell01,node=centurionNode01,server=webpreint443 ][ SampleEAREJB_TAR SampleEAREJB_TAR.jar,META-INF/ejb-jar.xml WebSphere:cell=myCellCell01,cluster=BatchSampleEAR+WebSphere:cell=myCellCell01,node=centurionNode01,server=webpreint443 ][ SampleEAREJB_AGE SampleEAREJB_AGE.jar,META-INF/ejb-jar.xml WebSphere:cell=myCellCell01,cluster=BatchSampleEAR+WebSphere:cell=myCellCell01,node=centurionNode01,server=webpreint443 ][ SampleEAREJB_PLN SampleEAREJB_PLN.jar,META-INF/ejb-jar.xml WebSphere:cell=myCellCell01,cluster=BatchSampleEAR+WebSphere:cell=myCellCell01,node=centurionNode01,server=webpreint443 ][ ArqEjbGOperaciones.jar ArqEjbGOperaciones.jar,META-INF/ejb-jar.xml WebSphere:cell=myCellCell01,cluster=BatchSampleEAR+WebSphere:cell=myCellCell01,node=centurionNode01,server=webpreint443 ][ SampleEAREJB_GCO SampleEAREJB_GCO.jar,META-INF/ejb-jar.xml WebSphere:cell=myCellCell01,cluster=BatchSampleEAR+WebSphere:cell=myCellCell01,node=centurionNode01,server=webpreint443 ][ SampleEARWeb SampleEARWeb.war,WEB-INF/web.xml WebSphere:cell=myCellCell01,cluster=BatchSampleEAR+WebSphere:cell=myCellCell01,node=centurionNode01,server=webpreint443 ][ ArqBatchS ArqBatchSWeb.war,WEB-INF/web.xml WebSphere:cell=myCellCell01,cluster=BatchSampleEAR+WebSphere:cell=myCellCell01,node=centurionNode01,server=webpreint443 ][ SampleEARWebInterno SampleEARWebInterno.war,WEB-INF/web.xml WebSphere:cell=myCellCell01,cluster=BatchSampleEAR+WebSphere:cell=myCellCell01,node=centurionNode01,server=webpreint443 ]] -MapWebModToVH [[ SampleEARWebInterno SampleEARWebInterno.war,WEB-INF/web.xml SampleEAR_private_host ]] -MapSharedLibForMod [[ BatchSampleEAR META-INF/application.xml LibAxis14+SampleEARlib ]]] % (APP_NAME)' )
AdminConfig.save()

谢谢。

所以我终于找到了路

这个有效:

/installableApps/'+APP_NAME+'

希望这对某人有所帮助。