繁体   English   中英

为 wlst 创建命令

[英]create a command for wlst

我必须挂载一个命令来执行它到 wlst。 创建子部署时,您需要将其定位到每个 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 个 JMSServer 的命令示例

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)

command 和 command_add 应该在 for 循环中设置,因为它们包含对目标变量的引用

final_command = 命令

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM