-MapModulesToServers
-MapWebModToVH
-CtxRootForWebMod.
Then I realised these could be wild-carded. The result still looks a bit archaic but it's a big improvement.
import sys war = sys.argv[0] name = sys.argv[1] cluster = sys.argv[2] cr = sys.argv[3] cellId = AdminConfig.list('Cell') cell = AdminConfig.showAttribute(cellId, 'name') AdminApp.install(war, '[ -appname '+name+' -contextroot '+cr+' -MapModulesToServers [[ .* .* WebSphere:cell='+cell+',cluster='+cluster+' ]] -MapWebModToVH [[ .* .* default_host ]] -CtxRootForWebMod [[ .* .* '+cr+' ]]]' ) AdminConfig.save()
It's worth noting that only -MapWebModToVH and -MapModulesToServer are required, therefore a if you're in a hurry you can use a shorter version:
import sys war = sys.argv[0] cluster = sys.argv[1] AdminApp.install(war, '[-MapWebModToVH [[ .* .* default_host ]] -MapModulesToServers [[ .* .* WebSphere:cluster='+cluster+']]]') AdminConfig.save()
If you chose this simpler method the Application name is chosen for you and the context root is set to /
Lastly (and this is where my OCD really kicked in) ... I really didn't like the way the second argument to AdminApp.install was just a long string, so I worked out that you can also do it like this... (not really sure if it's any simpler though)
import sys war = sys.argv[0] cluster = sys.argv[1] AdminApp.install( war, [ '-MapWebModToVH', [ [ '.*', '.*', 'default_host'] ], '-MapModulesToServers', [ [ '.*', '.*', 'WebSphere:cluster='+cluster ] ] ] ) AdminConfig.save()
No comments:
Post a Comment