2016-05-26 31 views
-1

Können Sie bitte in das folgende Problem schauen?IBM Websphere - wsadmin-Skript für AutoDeployment

import time 
node = AdminConfig.getid('/Node:node111/') 
print node 
print "sss" +AdminControl.queryNames('WebSphere:type=Server,*') 
cell = AdminControl.getCell() 
print " Cell name is --> "+ cell 
warLoc='/home/test/PA_Test.war' 
appName='PA_Test' 
cellName=AdminControl.getCell() 
print cellName 
nodeName=AdminControl.getNode() 
print "hello" 
print " nodeName is --> "+ nodeName 
appManager=AdminControl.queryNames('cell='+cellName+',node=node111,type=ApplicationManager,process=WebSphere_Portal,*') 
print appManager 
application = AdminConfig.getid("/Deployment:"+appName+"/") 
print 'printing application name in next line' 
print application 
len(application) 
print application 
len(application) 
var1 = len(application) 
if var1: 
    print "Application exists" 
    print "before uninstall" 
    AdminApp.uninstall('PA_Test') 
    print "after uninstall" 
    AdminConfig.save() 
else: 
    print "Application doesnot exist" 
print "Before install" 
print AdminApp.install(warLoc,'[-target default -usedefaultbindings -defaultbinding.virtual.host default_host]') 
print "Done from My Side" 
print "After install" 
AdminConfig.save() 
time.sleep(30) 
AdminControl.invoke(appManager , 'startApplication',appName) 
print "The script is completed."  

Below is the successful message: 

ADMA5016I: Installation of PA_Test.war154ed2178ed started. 
ADMA5058I: Application and module versions are validated with versions of deployment targets. 
ADMA5005I: The application PA_Test.war154ed2178ed is configured in the WebSphere Application Server repository. 
ADMA5005I: The application PA_Test.war154ed2178ed is configured in the WebSphere Application Server repository. 
ADMA5081I: The bootstrap address for client module is configured in the WebSphere Application Server repository. 
ADMA5053I: The library references for the installed optional package are created. 
ADMA5001I: The application binaries are saved in /opt/IBM/WebSphere/wp_profile/wstemp/Script154ed215c59/workspace/cells/inpudingpwmtst1Cell/applications/PA_Test.war154ed2178ed.ear/PA_Test.war154ed2178ed.ear 

Jetzt bin ich in der Lage, den Krieg zu implementieren, aber der Dateiname wird PA_Test.war154ed2178ed.ear immer ändern, aber seine eigentlich sollte PA_Test.ear sein. Kannst du bitte helfen, das aktuelle Skript zu ändern?

Antwort

1

Kurze Antwort:

print AdminApp.install(warLoc, [ 
    '-appname', 'PA_Test.ear', 
    '-target', 'default', 
    '-usedefaultbindings', 
    '-defaultbinding.virtual.host', 'default_host' 
]) 

Auch kürzere: WDR verwenden.

Sie erhalten eine Anwendung-Manifest-Datei benötigen PA_Test.wdra:

PA_Test.ear pa.war 
    target default 
    usedefaultbindings 
    defaultbinding.virtual.host default_host 

... und Skript Jython dieses Manifest zu importieren:

alreadyInstalled = 'PA_Test.ear' in AdminApp.list().splitlines() 
importApplicationManifest('PA_Test.wdra') 
save() 
sync() 
while AdminApp.isAppReady('PA_Test.ear') != 'true': 
    time.sleep(10) 
if not alreadyInstalled: 
    for appMgr in queryMBeans(type='ApplicationManager', process='WebSphere_Portal'): 
     appMgr.startApplication('PA_Test.ear') 

Disclosure: Ich bin ein Mitwirkender und Betreuer von WDR

+0

Durch dein Skript Marcin kann ich es bereitstellen. Eine weitere Frage, die ich habe, d. H., Wie man Portlet mit Seite abbildet, indem man den Prozess automatisiert macht? – user1251973