def getVersionInfoFromWar(warPath, relativeVersionInformationPath, versionInformationRegex, revisionInformationRegex, tmpPath):
    if os.path.isfile(warPath):
        #This is a war file
        i = rfind(relativeVersionInformationPath, scriptGlobals.osDirSeparator)
        if i > -1: 
            manifest = relativeVersionInformationPath[i+1:]
        else:
            manifest = relativeVersionInformationPath
        extractFileFromZipToDir(warPath, relativeVersionInformationPath, tmpPath)
        version = grepFile(versionInformationRegex, tmpPath + scriptGlobals.osDirSeparator + manifest)
        revision = grepFile(revisionInformationRegex, tmpPath + scriptGlobals.osDirSeparator + manifest)
    elif os.path.isdir(warPath):
        #This is a exploded war directory
        version = grepFile(versionInformationRegex, warPath + scriptGlobals.osDirSeparator + relativeVersionInformationPath)
        revision = grepFile(revisionInformationRegex, warPath + scriptGlobals.osDirSeparator + relativeVersionInformationPath)
    else:
        return "UNKNOWN", "UNKNOWN"
    version = (re.sub(versionInformationRegex,"",version)).strip() #(version.replace(versionInformationRegex, "")).strip()
    revision = (re.sub(revisionInformationRegex,"",revision)).strip() #(revision.replace(revisionInformationRegex, "")).strip()
    return version, revision    
Ejemplo n.º 2
0
from actions.FileSystemActions import ChangePathPermissions



try: 
    
    # Print OS information
    printOsInformation()
    
    # Check for required executables   
    #checkRequiredExecutablesExist(scriptGlobals.requiredExecutables)
    
    # Initialize working dir
    createDirectoriesRecursively(scriptGlobals.workingDir)
    log.info("Working directory '" + scriptGlobals.workingDir + "'")
    
    # Get Module Properties file
    moduleProperties = extractFileFromZipToDir(parser.options.module, scriptGlobals.modulePropertiesFile, scriptGlobals.workingDir)
    log.info("Module properties file '" + moduleProperties + "'")
    
    # Initialize module to be deployed
    module = Module(parser.options.module, moduleProperties, parser.options.envprops)
       
    # Initialize Module Action Bundle
#    ab = initClassFromStringWithModule(readPropertyFromPropertiesFile("module" + parser.options.action + "AB", scriptGlobals.moduleSectionName, parser.options.modprops), module)

    raw_input("")
#    import code; code.interact(local=locals())

except: 
    raise
 def __call__(self): 
     extractFileFromZipToDir(self.zipFilename, self.filenameToExtract, self.location)