[英]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.