def execute(self, oracleSid, oracleUser, oraclePasswd, oracleScript, paramA, paramB, ignoreErrors): try: startupInfo = self.getStartupInfo() projectHelper = self.getProjectHelper() handle = open('feedback.log', 'wb') credentials = oracleUser + '/' + oraclePasswd + '@' + oracleSid statement = 'loadjava -user ' + credentials + ' -resolve -force ' + projectHelper.cleanPath( oracleScript) p = Popen([statement], stdout=PIPE, shell=True) output, error = p.communicate() # # templateScript='@'+projectHelper.cleanPath(self.getScriptDir()+os.sep+'template.sql') # print executeList # result = subprocess.call(executeList, shell=True, stdout=handle, stderr=handle, startupinfo=startupInfo) # stream = projectHelper.readFile('feedback.log') logger = logging.getLogger('NoOraLogger') logger.info(oracleScript) if error: # stream = StreamHelper.StreamHelper().convert(stream) # stream = stream.replace(chr(10),chr(32)) logger.error(error) if ignoreErrors == False: raise NooraException.NooraException(error) else: logger.info(output) except OSError: raise NooraException.NooraException( "Could not execute loadjava. Is it installed and in your path?" )
def execute(self, oracleSid, oracleUser, oraclePasswd, oracleScript, paramA, paramB, ignoreErrors): try: startupInfo = self.getStartupInfo() projectHelper = self.getProjectHelper() handle = open('feedback.log', 'wb') connectString = oracleUser + '/' + oraclePasswd + '@' + oracleSid templateScript = '@' + projectHelper.cleanPath( self.getScriptDir() + os.sep + 'template.sql') result = subprocess.call([ 'sqlplus', '-l', '-s', connectString, templateScript, projectHelper.cleanPath(oracleScript), paramA, paramB ], shell=False, stdout=handle, stderr=handle, startupinfo=startupInfo) stream = projectHelper.readFile('feedback.log') logger = logging.getLogger('NoOraLogger') logger.info(oracleScript) if result != 0: #stream = StreamHelper.StreamHelper().convert(stream) #stream = stream.replace(chr(10),chr(32)) logger.error(stream) if ignoreErrors == False: raise NooraException.NooraException(stream) else: logger.info(stream) except OSError: raise NooraException.NooraException( "Could not execute sqlplus. Is it installed and in your path?")
def installComponent(self, url, mysqlHost, database, mysqlUser, mysqlPasswd): projectHelper=self.getProjectHelper() handle=open('feedback.log','wb') result=subprocess.call(['python',url+os.sep+'setup.py','-h='+mysqlHost,'-d='+database,'-u='+mysqlUser,'-p='+mysqlPasswd,'-silent'],shell=False,stdout=handle,stderr=handle) if result!=0: stream=projectHelper.readFile('feedback.log') raise NooraException.NooraException(stream)
def execute(self, oracleSid, oracleUser, oraclePasswd, ctlFile, dataFile, ignoreErrors): try: startupInfo=self.getStartupInfo() projectHelper=self.getProjectHelper() handle=open('feedback.log','wb') connectString=oracleUser+'/'+oraclePasswd+'@'+oracleSid controlString='control='+ctlFile dataString='data='+dataFile result=subprocess.call(['sqlldr',connectString , controlString, dataString],shell=False,stdout=handle,stderr=handle,startupinfo=startupInfo) stream=projectHelper.readFile('feedback.log') logger = logging.getLogger('NoOraLogger') logger.info(dataFile) if result!=0: #stream = StreamHelper.StreamHelper().convert(stream) #stream = stream.replace(chr(10),chr(32)) logger.error(stream) if ignoreErrors==False: raise NooraException.NooraException(stream) else: logger.info(stream) except OSError: raise NooraException.NooraException("Could not execute sqlldr. Is it installed and in your path?")
def failOnFolderPresent(self, folder, message): if self.folderPresent(folder): raise NooraException.NooraException(message)
def failOnEmpty(self, values, message): if len(values) == 0: raise NooraException.NooraException(message)
def invalidBuildFolder(self, buildFolder): if self.folderNotPresent(buildFolder): raise NooraException.NooraException('build folder is not present.')
def failOnValueNotFound(self, list, value, message): if self.hasValue(list, value) == False: raise NooraException.NooraException(message)
def failOnFileNotPresent(self, url, message): if self.fileNotPresent(url): raise NooraException.NooraException(message)
def failOnNone(self, value, message): if value == None: raise NooraException.NooraException(message)
def failOnValueFound(self, keyword, values, message): for value in values: if self.hasValue(keyword, value) == True: raise NooraException.NooraException(message)
def invalidValue(self, keyword, values): for value in values: if self.hasValue(keyword, value) == False: raise NooraException.NooraException("the given value " + value + " for keyword " + keyword + " is not valid for this project.")
def failOnPluginNotFound(message): raise NooraException.NooraException(message)