I have to mount a command to execute it to wlst. when you create a SubDeployment you need to target it to each JMSServer.:
set('Targets',jarray.array([ObjectName('com.bea:Name=MyVirtualHost_MS1,Type=VirtualHost'),ObjectName('com.bea:Name=MyVirtualHost_MS2,Type=VirtualHost')], ObjectName))
you have to add at the end of the command -->
",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)"
this is an example of a command with 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))
but I don't get to substitute target variable for the value in each iteration.
I have used this code:
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 and command_add should be set in the for loop because they include references to target variable
and
final_command = command
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.