【问题标题】:create a command for wlst为 wlst 创建一个命令
【发布时间】:2020-05-09 13:30:39
【问题描述】:

我必须挂载一个命令来执行它到 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 个 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)

【问题讨论】:

    标签: python weblogic wlst


    【解决方案1】:

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

    final_command = 命令

    【讨论】:

      猜你喜欢
      • 2019-04-02
      • 2012-01-30
      • 2019-07-15
      • 2018-03-14
      • 2010-11-18
      • 2013-09-22
      • 2014-07-25
      • 1970-01-01
      • 2018-02-16
      相关资源
      最近更新 更多