我必须挂载一个命令来将其执行到wlst。创建SubDeployment时,需要将其指向每个JMSServer。:
set('Targets',jarray.array([ObjectName('com.bea:Name=MyVirtualHost_MS1,Type=VirtualHost'),ObjectName('com.bea:Name=MyVirtualHost_MS2,Type=VirtualHost')], ObjectName))您必须在命令的末尾添加-->
",ObjectName('com.bea:Name='+target+',Type=JMSServer')") for each _JMSServer that you have.
finally you have to add at the end of the command -> "], ObjectName)"这是一个带有3个JMSServers的命令示例
set('Targets',jarray.array([ObjectName('com.bea:Name='+target+,Type=JMSServer'),ObjectName('com.bea:Name='+target+',Type=JMSServer'),ObjectName('com.bea:Name='+target+',Type=JMSServer'),ObjectName('com.bea:Name='+target+',Type=JMSServer'),ObjectName('com.bea:Name='+target+',Type=JMSServer')], ObjectName))但是我不能用目标变量来代替每次迭代中的值。
我使用了以下代码:
command = "set('Targets',jarray.array([ObjectName('com.bea:Name='+target+,Type=JMSServer')"
command_add = ",ObjectName('com.bea:Name='+target+',Type=JMSServer')"
command_last = "], ObjectName))"
jms = ['JMSServer1','JMSServer2','JMSServer3']
for target in jms:
command += command_add
final_command = command + command_last
print (final_command)发布于 2020-01-23 23:58:36
命令和command_add应在for循环中设置,因为它们包含对目标变量的引用
和
final_command =命令
https://stackoverflow.com/questions/59875810
复制相似问题