0

There is a command

application = raw_input('Enter the application name you want to deploy\t\n')
connect('weblogic','weblogic','t3://host:port')
deploy(appName='application', 
       path='/home/application.war', 
       targets='MS1', 
       upload='true')
startApplication(appName='application')

In the above, application is a value entered by the user, and that value should be substituted in the commands deploy and startApplication of wlst.

I tried using %s % value and .format(value=value), but I couldn't substitute the value of application in the deploy command.

How do we do it ? Any Ideas ?

I am using python 2.3.4

4

1 回答 1

0

您不应该application用引号将变量括起来,因为它将被视为字符串。这应该适合你:

application = raw_input('Enter the application name you want to deploy\t\n')

connect('weblogic','weblogic','t3://host:port')

deploy(appName=application,
       path='/home/%s.war' % application, 
       targets='MS1', 
       upload='true')

startApplication(appName=application)
于 2013-05-03T23:57:52.553 回答