开发者

Jython- using variables in function calls syntax

开发者 https://www.devze.com 2023-03-14 05:38 出处:网络
I am working with Jython to automate deployments in WebSphere. I am wrapping my py script with a shell script to pass needed variables for WAS\'s built-in functions.

I am working with Jython to automate deployments in WebSphere. I am wrapping my py script with a shell script to pass needed variables for WAS's built-in functions.

The stock call with hardcoded values looks like this:

appManager=AdminControl.queryNames('cell=wsapp2Node01Cell,node=TARGETNODE,type=
                                       ApplicationManager,process=server1,*')
AdminControl.invoke(appManager, 'stopApplication', 'ApplicationName')

I want to replace ApplicationName with my variab开发者_C百科le and still retain quotes but can't figure out the syntax.

MyAppVariable= sys.argv[3]
appManager = AdminControl.queryNames('cell=wsapp2Node01Cell,node=TARGETNODE,type=
                                         ApplicationManager,process=server1,*')
AdminControl.invoke(appManager, 'stopApplication', 'MyAppVariable')

Can anyone help me please?


It looks like the answer is as simple as the following:

AdminControl.invoke(appManager, 'stopApplication', MyAppVariable)

Does that work? If not, what does it do?

0

精彩评论

暂无评论...
验证码 换一张
取 消