执行以下脚本以部署SOA组合并获取NameError:checkDeployStatus。下面的脚本部署每个组合并检查日志以查看它是否已部署。
Deploysoa.py
from java.io import FileInputStream
from java.util import HashMap
from java.util import HashSet
from java.util import ArrayList
from java.io import File
from java.net import URL
import sys
import os
import javax
import java
print '++++++++starting deployment+++++++++'
connect('weblogic', 'password', 't3://stabc:8001')
dirList=os.listdir(sys.argv[0])
for jarfile in dirList:
if (jarfile.startswith("sca_") & jarfile.endswith(".jar")):
print 'deploying ' + jarfile + ' with ' + jarfile.replace(' ', '')[:-11] + '_cfgplan' + '.xml'
oldstdout=sys.stdout
sys.stdout = open("/tmp/sca_deploy.out","w")
sca_deployComposite(serverURL, sarLocation, [overwrite], [user], [password], [forceDefault], [configplan], [partition])
sys.stdout = oldstdout
print '++++++++++++++++++Checking deploy Status++++++++++++++++'
checkDeployStatus("/tmp/sca_deploy.out")
print '+++++++++++++++++++Test passed++++++++++++++++++++++'
def checkDeployStatus(filename):
success = false
for line in open(filename):
if "Deploying composite success" in line:
print '++++++++++++++++++++++++++++++Composite is Alright++++++++++++++++++++++'
success=true
if "error" in line:
success=false
if success is false:
print line
raise Exception("Deployment Failed")
答案 0 :(得分:0)
很难分辨,因为缩进是关闭的,但似乎checkDeployStatus
在首次调用之后定义了,这将导致NameError