def __init__(self, module): """ Constructor """ ActionBundle.__init__(self, module) # Generate a unique ActionBundle execution id guid = generateGUID() log.info("Unique ActionBundle execution ID generated: " + guid) # Prepare directory to unpack package unzippedPackagePath = createDirectoriesRecursively( scriptGlobals.workingDir + scriptGlobals.osDirSeparator + "unzippedPackage" ) # Extract CRM package into tmp dir ExtractZipToDir(module.moduleFilename, unzippedPackagePath) # Get Version, Revision information versionInfo, revisionInfo = getVersionAndRevisionInfo( module.versionInformationRegex, module.revisionInformationRegex, unzippedPackagePath, module.relativeVersionInformationPath, ) module.executionContext["unzippedPackagePath"] = unzippedPackagePath module.executionContext["versionInfo"] = versionInfo module.executionContext["revisionInfo"] = revisionInfo module.executionContext["guid"] = guid
def __init__(self, module): ''' Constructor ''' ActionBundle.__init__(self, module) # Generate a unique ActionBundle execution id guid = generateGUID() log.info("Unique ActionBundle execution ID generated: " + guid) # Configure marketing-suite-admin.properties using envprops # Configure mgage.properties using envprops for k, v in module.relativeConfigurationFiles.items(): exactExtractedLocation = module.subModule.unzippedPackagePath + scriptGlobals.osDirSeparator + k ConfigureTemplateFile(module.name, lib.OptParser.options.envprops, exactExtractedLocation) CheckFileConfigurationIsComplete(exactExtractedLocation) # Copy marketing-suite-admin.properties to conf # Copy mgage.properties to conf # Copy jboss-log4j.xml to conf for k, v in module.relativeConfigurationFiles.items(): exactExtractedLocation = module.subModule.unzippedPackagePath + scriptGlobals.osDirSeparator + k exactTargetLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v CopyDirOrFile(exactExtractedLocation, exactTargetLocation)
def __init__(self, module): ''' Constructor ''' ActionBundle.__init__(self, module) # Check if JBOSS is running if getProcessPIDByPath(module.targetDeploymentPath):die("The JBOSS server at '" + module.targetDeploymentPath + "' is up. Installation will not continue") # Generate a unique ActionBundle execution id guid = generateGUID() log.info("Unique ActionBundle execution ID generated: " + guid) # Prepare directory to unpack package module.subModule.unzippedPackagePath = createDirectoriesRecursively(scriptGlobals.workingDir + scriptGlobals.osDirSeparator + "unzippedPackage") # Extract MS Admin package into tmp dir ExtractZipToDir(module.moduleFilename, module.subModule.unzippedPackagePath) # Prepare directory to unpack package module.subModule.previousVersionBackupPath = createDirectoriesRecursively(scriptGlobals.workingDir + scriptGlobals.osDirSeparator + "previousVersionBackup") # Extract new MANIFEST.MF ExtractFileFromZipToDir(module.subModule.unzippedPackagePath + scriptGlobals.osDirSeparator + module.subModule.relativeWarPath, module.relativeVersionInformationPath, module.subModule.unzippedPackagePath) # Prepare directory to keep backups # Since MS is deployed on JBOSS some paths have an %s to allow a configurable # profile, so do a little sprintf to fix them sprintfOnDictionaryValues(module.relativeConfigurationFiles, module.targetDeploymentProfile) sprintfOnDictionaryValues(module.relativeCopyableFilesOrFolders, module.targetDeploymentProfile)
def __init__(self, module): ''' Constructor ''' guid = generateGUID() log.info("Unique ActionBundle execution ID generated: " + guid) pid = getProcessPIDByPathAndIdentifier(module.targetDeploymentPath, module.subModule.processIdentifier) # If process exists... if pid: # Kill process using pid killProcess(pid) # Construct the email notification emailSender = readPropertyFromPropertiesFileWithFallback("emailNotificationSenderAddress", scriptGlobals.scriptVarSectionName, lib.OptParser.options.envprops, scriptGlobals.emailNotificationSenderAddress) emailRecipients = module.emailNotificationRecipientList emailSubject = "Server KILL: " + module.subModule.name + "@"+ getCurrentHostname() + " (" + module.friendlyServerName + ")" emailText = killApplicationServerNotificationTemplate(module.name, getCurrentHostname(), guid) # Email all required parties SendEmail(emailSender, emailRecipients, emailSubject, emailText, scriptGlobals.smtpHost, scriptGlobals.smtpPort)
def __init__(self, module): ''' Constructor ''' ActionBundle.__init__(self, module) # Initialize application server object # appServer = ApplicationServer(module, scriptGlobals.appsrvProperties) # Generate a unique ActionBundle execution id guid = generateGUID() log.info("Unique ActionBundle execution ID generated: " + guid) # Check if Server is running if getProcessPIDByPathAndIdentifier(module.targetDeploymentPath, module.subModule.processIdentifier): die("\n\nThe " + module.subModule.name + " server at '" + module.targetDeploymentPath + "' is up. Installation will not continue\n") # Run script moduleDeployPath = module.targetDeploymentPath + "/" + module.subModule.name path2 = moduleDeployPath + "/" + module.subModule.installUpdateScript ChangePathPermissions(path2, 0744) path2=path2 + " CREATE YES " ExecuteOSCommand(path2, None) # Find version/revision info manifestFilePath=moduleDeployPath + "/META-INF/MANIFEST.MF" versionInfo = grepFile(module.versionInformationRegex, manifestFilePath) buildInfo = grepFile(module.buildInformationRegex, manifestFilePath) revisionInfo = grepFile(module.revisionInformationRegex, manifestFilePath) versionInfo = (versionInfo.replace(module.versionInformationRegex, "")).strip() if buildInfo != None: buildInfo = (buildInfo.replace(module.buildInformationRegex, "")).strip() revisionInfo = (revisionInfo.replace(module.revisionInformationRegex, "")).strip() # Construct the email notification emailSender = readPropertyFromPropertiesFileWithFallback("emailNotificationSenderAddress", scriptGlobals.scriptVarSectionName, lib.OptParser.options.envprops, scriptGlobals.emailNotificationSenderAddress) emailRecipients = scriptGlobals.globalNotificationEmailList emailSubject = "MSM Installation: " + module.name + "@"+ getCurrentHostname() + " (" + module.friendlyServerName + ")" emailText = detailedCleanInstallationReportTemplate(module.subModule.name, versionInfo, lib.OptParser.options.action, getCurrentHostname(), os.getcwd(), guid, " ".join(platform.uname()), getpass.getuser(), buildInfo, revisionInfo, lib.OptParser.options.envprops, scriptGlobals.workingDir) # Email all required parties SendEmail(emailSender, emailRecipients, emailSubject, emailText, scriptGlobals.smtpHost, scriptGlobals.smtpPort)
def __init__(self, module): ''' Constructor ''' ActionBundle.__init__(self, module) # Check if JBOSS is running if getProcessPIDByPath(module.targetDeploymentPath):die("The JBOSS server at '" + module.targetDeploymentPath + "' is up. Installation will not continue") # Generate a unique ActionBundle execution id guid = generateGUID() log.info("Unique ActionBundle execution ID generated: " + guid) unzippedPackagePath = module.subModule.unzippedPackagePath # Import Clean DB script to Postgres DB dbUsername = readPropertyFromPropertiesFile("TARGET_POSTGRES_SRV_DB_OWNER", module.name, lib.OptParser.options.envprops) dbPassword = readPropertyFromPropertiesFile("TARGET_POSTGRES_SRV_DB_PASSWORD", module.name, lib.OptParser.options.envprops) dbHostName = readPropertyFromPropertiesFile("TARGET_POSTGRES_SRV_HOSTNAME", module.name, lib.OptParser.options.envprops) dbName = readPropertyFromPropertiesFile("TARGET_POSTGRES_SRV_DB_NAME", module.name, lib.OptParser.options.envprops) dbPort = readPropertyFromPropertiesFile("TARGET_POSTGRES_SRV_PORT", module.name, lib.OptParser.options.envprops) tmpC = "jdbc:postgresql://" + dbHostName + ":" + dbPort + "/" + dbName # Find version/revision info versionInfo = grepFile(module.versionInformationRegex, unzippedPackagePath + scriptGlobals.osDirSeparator + "MANIFEST.MF") revisionInfo = grepFile(module.revisionInformationRegex, unzippedPackagePath + scriptGlobals.osDirSeparator + "MANIFEST.MF") versionInfo = (versionInfo.replace(module.versionInformationRegex, "")).strip() revisionInfo = (revisionInfo.replace(module.revisionInformationRegex, "")).strip() # Determine last executed script in DB dbUsername = readPropertyFromPropertiesFile("TARGET_POSTGRES_SRV_DB_OWNER", module.name, lib.OptParser.options.envprops) dbPassword = readPropertyFromPropertiesFile("TARGET_POSTGRES_SRV_DB_PASSWORD", module.name, lib.OptParser.options.envprops) dbHostName = readPropertyFromPropertiesFile("TARGET_POSTGRES_SRV_HOSTNAME", module.name, lib.OptParser.options.envprops) dbName = readPropertyFromPropertiesFile("TARGET_POSTGRES_SRV_DB_NAME", module.name, lib.OptParser.options.envprops) dbPort = readPropertyFromPropertiesFile("TARGET_POSTGRES_SRV_PORT", module.name, lib.OptParser.options.envprops) tmpC = "jdbc:postgresql://" + dbHostName + ":" + dbPort + "/" + dbName result = runPostgresScript("SELECT EXECUTED_SCRIPT FROM FIREWORKS_SCRIPT_LOG WHERE EXECUTED_ON IN (SELECT MAX(EXECUTED_ON) FROM FIREWORKS_SCRIPT_LOG);", dbUsername, dbPassword, tmpC) lastExecutedPath, lastExecutedFilename = os.path.split(result.strip()); log.info("According to log table, the last script executed on '" + tmpC + "' was '" + lastExecutedFilename + "'") # Run scripts on DB ls = os.listdir(unzippedPackagePath + scriptGlobals.osDirSeparator + module.relativeDatabaseUpgradeFilePath) ls.sort() found = False for patch in ls: if found: #Replace Owner exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + module.relativeDatabaseUpgradeFilePath + scriptGlobals.osDirSeparator + patch ConfigureTemplateFile(module.name, lib.OptParser.options.envprops, exactExtractedLocation) CheckFileConfigurationIsComplete(exactExtractedLocation) #Run Script RunPostgresScriptFromFile(unzippedPackagePath + scriptGlobals.osDirSeparator + module.relativeDatabaseUpgradeFilePath + scriptGlobals.osDirSeparator + patch, dbUsername, dbPassword, tmpC) # Log executed scripts RunPostgresScript("INSERT INTO FIREWORKS_SCRIPT_LOG (INSTALLATION_ID, ACTION, MODULE_NAME, MODULE_VERSION, MODULE_REVISION, EXECUTED_SCRIPT, EXECUTED_ON) VALUES ('" + guid + "', '" + lib.OptParser.options.action + "', '" + module.name + "', '" + versionInfo + "', '" + revisionInfo + "', '" + patch + "', CURRENT_TIMESTAMP);", dbUsername, dbPassword, tmpC) if lastExecutedFilename.find(patch) > -1: found = True
def __init__(self, module): ''' Constructor ''' ActionBundle.__init__(self, module) # Generate a unique ActionBundle execution id guid = generateGUID() log.info("Unique ActionBundle execution ID generated: " + guid) # Check if standalone is running if getProcessPIDByPathAndIdentifier(module.targetDeploymentPath, module.subModule.processIdentifier): die("\n\nThe " + module.subModule.name + " server at '" + module.targetDeploymentPath + "' is up. Configuration will not continue\n") # Check if module is already installed for k, v in module.relativeCopyableFilesOrFolders.items(): exactLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v if not os.path.isdir(exactLocation): die(module.subModule.name + " is Not already installed to:" + module.targetDeploymentPath + ". Maybe you want to make a clean Installation !!") # Get Previous Hudson data previousManifilePath = module.targetDeploymentPath + scriptGlobals.osDirSeparator + module.subModule.name + scriptGlobals.osDirSeparator + "META-INF" + scriptGlobals.osDirSeparator + "MANIFEST.MF" previousVersionInfo = grepFile(module.versionInformationRegex, previousManifilePath) previousBuildInfo = grepFile(module.buildInformationRegex, previousManifilePath) previousRevisionInfo = grepFile(module.revisionInformationRegex, previousManifilePath) previousRevisionInfo = (previousRevisionInfo.replace(module.revisionInformationRegex, "")).strip() previousVersionInfo = (previousVersionInfo.replace(module.versionInformationRegex, "")).strip() if previousBuildInfo != None: previousBuildInfo = (previousBuildInfo.replace(module.buildInformationRegex, "")).strip() # Construct the email notification emailSender = readPropertyFromPropertiesFileWithFallback("emailNotificationSenderAddress", scriptGlobals.scriptVarSectionName, lib.OptParser.options.envprops, scriptGlobals.emailNotificationSenderAddress) emailRecipients = scriptGlobals.globalNotificationEmailList emailSubject = "MSM Installation: " + module.name + "@"+ getCurrentHostname() + " (" + module.friendlyServerName + ")" emailText = detailedCleanInstallationReportTemplate(module.subModule.name, previousVersionInfo, lib.OptParser.options.action, getCurrentHostname(), os.getcwd(), guid, " ".join(platform.uname()), getpass.getuser(), previousBuildInfo, previousRevisionInfo, lib.OptParser.options.envprops, scriptGlobals.workingDir) # Email all required parties SendEmail(emailSender, emailRecipients, emailSubject, emailText, scriptGlobals.smtpHost, scriptGlobals.smtpPort) # end
def __init__(self, module): ''' Constructor ''' ActionBundle.__init__(self, module) # Generate a unique ActionBundle execution id guid = generateGUID() log.info("Unique ActionBundle execution ID generated: " + guid) # Check if JBOSS is running if getProcessPIDByPath(module.targetDeploymentPath): die("The JBOSS server at '" + module.targetDeploymentPath + "' is up. Installation will not continue") # Prepare directory to unpack package unzippedPackagePath = createDirectoriesRecursively(scriptGlobals.workingDir + scriptGlobals.osDirSeparator + "unzippedPackage") # Since Builder is deployed on JBOSS some paths have an %s to allow a configurable # profile, so do a little sprintf to fix them sprintfOnDictionaryValues(module.relativeConfigurationFiles, module.targetDeploymentProfile) sprintfOnDictionaryValues(module.relativeCopyableFilesOrFolders, module.targetDeploymentProfile) sprintfOnListValues(module.subModule.relativeCleanUpFiles, module.targetDeploymentProfile) # Extract Builder package into tmp dir ExtractZipToDir(module.moduleFilename, unzippedPackagePath) # Do this again in case new settings have been added # Configure m-web-builder.properties using envprops # Configure mgage.properties using envprops for k, v in module.relativeConfigurationFiles.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k ConfigureTemplateFile(module.name, lib.OptParser.options.envprops, exactExtractedLocation) CheckFileConfigurationIsComplete(exactExtractedLocation) # Copy m-web-builder.properties to conf # Copy mgage.properties to conf # Copy jboss-log4j.xml to conf for k, v in module.relativeConfigurationFiles.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k exactTargetLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v CopyDirOrFile(exactExtractedLocation, exactTargetLocation) # Clean up files that might have been left over from previous manuall installations cleanUp(module) # Copy artifacts to profile for k, v in module.relativeCopyableFilesOrFolders.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k exactTargetLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v CopyDirOrFile(exactExtractedLocation, exactTargetLocation) # Install Plugins staticFolder = readPropertyFromPropertiesFile("STATIC_FOLDER", module.name, lib.OptParser.options.envprops) installDefaultPlugins(staticFolder, unzippedPackagePath, module)
def __init__(self, module): ''' Constructor ''' ActionBundle.__init__(self, module) # Check if JBOSS is running if getProcessPIDByPath(module.targetDeploymentPath):die("The JBOSS server at '" + module.targetDeploymentPath + "' is up. Installation will not continue") # Generate a unique ActionBundle execution id guid = generateGUID() log.info("Unique ActionBundle execution ID generated: " + guid) unzippedPackagePath = module.subModule.unzippedPackagePath # Import Clean DB script to Postgres DB dbUsername = readPropertyFromPropertiesFile("TARGET_POSTGRES_SRV_DB_OWNER", module.name, lib.OptParser.options.envprops) dbPassword = readPropertyFromPropertiesFile("TARGET_POSTGRES_SRV_DB_PASSWORD", module.name, lib.OptParser.options.envprops) dbHostName = readPropertyFromPropertiesFile("TARGET_POSTGRES_SRV_HOSTNAME", module.name, lib.OptParser.options.envprops) dbName = readPropertyFromPropertiesFile("TARGET_POSTGRES_SRV_DB_NAME", module.name, lib.OptParser.options.envprops) dbPort = readPropertyFromPropertiesFile("TARGET_POSTGRES_SRV_PORT", module.name, lib.OptParser.options.envprops) tmpC = "jdbc:postgresql://" + dbHostName + ":" + dbPort + "/" + dbName # Run DB init script(s) for dbInitScript in module.relativeDatabaseInitFiles: # Replace Owner on init scripts exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + dbInitScript ConfigureTemplateFile(module.name, lib.OptParser.options.envprops, exactExtractedLocation) CheckFileConfigurationIsComplete(exactExtractedLocation) RunPostgresScriptFromFile(unzippedPackagePath + scriptGlobals.osDirSeparator + dbInitScript, dbUsername, dbPassword, tmpC) # Replace Owner on postgresLogTemplate ConfigureTemplateFile(module.name, lib.OptParser.options.envprops, scriptGlobals.postgresLogTemplateFile) # Add LOG table RunPostgresScriptFromFile(scriptGlobals.postgresLogTemplateFile, dbUsername, dbPassword, tmpC) # Find version/revision info versionInfo = grepFile(module.versionInformationRegex, unzippedPackagePath + scriptGlobals.osDirSeparator + "MANIFEST.MF") revisionInfo = grepFile(module.revisionInformationRegex, unzippedPackagePath + scriptGlobals.osDirSeparator + "MANIFEST.MF") versionInfo = (versionInfo.replace(module.versionInformationRegex, "")).strip() revisionInfo = (revisionInfo.replace(module.revisionInformationRegex, "")).strip() # Add one row per script executed in LOG table for dbInitScript in module.relativeDatabaseInitFiles: lastExecutedPath, lastExecutedFilename = os.path.split(dbInitScript) RunPostgresScript("INSERT INTO FIREWORKS_SCRIPT_LOG (INSTALLATION_ID, ACTION, MODULE_NAME, MODULE_VERSION, MODULE_REVISION, EXECUTED_SCRIPT, EXECUTED_ON) VALUES ('" + guid + "', '" + lib.OptParser.options.action + "', '" + module.name + "', '" + versionInfo + "', '" + revisionInfo + "', '" + lastExecutedFilename + "', CURRENT_TIMESTAMP);", dbUsername, dbPassword, tmpC) # Already existing upgrade scripts must be logged because in the upcoming upgrade we need to run from there on log.info("Existing SQL patches will be logged in the log table so that the script will not run them again if you decise to update this version to latest") ls = os.listdir(unzippedPackagePath + scriptGlobals.osDirSeparator + module.relativeDatabaseUpgradeFilePath) ls.sort() for patch in ls: RunPostgresScript("INSERT INTO FIREWORKS_SCRIPT_LOG (INSTALLATION_ID, ACTION, MODULE_NAME, MODULE_VERSION, MODULE_REVISION, EXECUTED_SCRIPT, EXECUTED_ON) VALUES ('" + guid + "', '" + lib.OptParser.options.action + "', '" + module.name + "', '" + versionInfo + "', '" + revisionInfo + "', '" + patch + "', CURRENT_TIMESTAMP);", dbUsername, dbPassword, tmpC)
def __init__(self, module): ''' Constructor ''' ActionBundle.__init__(self, module) # Generate a unique ActionBundle execution id guid = generateGUID() log.info("Unique ActionBundle execution ID generated: " + guid) # Copy marketing-suite-admin.war to deploy for k, v in module.relativeCopyableFilesOrFolders.items(): exactExtractedLocation = module.subModule.unzippedPackagePath + scriptGlobals.osDirSeparator + k exactTargetLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v CopyDirOrFile(exactExtractedLocation, exactTargetLocation)
def __init__(self, module): ''' Constructor ''' guid = generateGUID() log.info("Unique ActionBundle execution ID generated: " + guid) # Check if server is running if getProcessPIDByPath(module.targetDeploymentPath): die("The server at '" + module.targetDeploymentPath + "' is up. Rollback will not continue.") # Deserialize objects and pass them to executedActionList log.info("Using '" + lib.OptParser.options.rollback + "' to perform Manual Rollback") scriptGlobals.executedActionList = deserializeListFromFile(lib.OptParser.options.rollback) # Raise dummy exception to enter the Rollback mechanism raise RollbackTriggerException
def __init__(self, module): ''' Constructor ''' guid = generateGUID() log.info("Unique ActionBundle execution ID generated: " + guid) # Check if Application Server is running appServer = ApplicationServer(module, scriptGlobals.appsrvProperties) if getProcessPIDByPathAndIdentifier(module.targetDeploymentPath, appServer.processIdentifier): die("The Application Server at '" + module.targetDeploymentPath + "' is up. Rollback will not continue.") # Deserialize objects and pass them to executedActionList scriptGlobals.executedActionList = deserializeListFromFile(lib.OptParser.options.rollback) # Raise dummy exception raise RollbackTriggerException
def __init__(self, module): ''' Constructor ''' guid = generateGUID() log.info("Unique ActionBundle execution ID generated: " + guid) # appServer = ApplicationServer(module, scriptGlobals.appsrvProperties) pid = getProcessPIDByPathAndIdentifier(module.targetDeploymentPath, module.subModule.processIdentifier) bin_path=module.targetDeploymentPath + "/" + module.subModule.name + "/bin/" if pid: log.info("\n\nAlready existing process running from path '" + module.targetDeploymentPath + "' with pid '" + pid + "'.\n") log.info("\n\Proceeding with Killing the Server") # Kill process using pid killProcess(pid) # Delete all cached directories log.info("Proceeding to delete nohup file") try: deleteDirOrFile(bin_path + "nohup.out") except OSError: # If directory doesn't exist ignore the raised error pass # Change directory to run the binary from inside the binpath pwd = os.getcwd() os.chdir(bin_path) ChangePathPermissions(bin_path + "start.sh", 0744) runProcess("nohup ./start.sh") os.chdir(pwd) # Construct the email notification emailSender = readPropertyFromPropertiesFileWithFallback("emailNotificationSenderAddress", scriptGlobals.scriptVarSectionName, lib.OptParser.options.envprops, scriptGlobals.emailNotificationSenderAddress) emailRecipients = module.emailNotificationRecipientList emailSubject = "Server START: " + module.subModule.name + "@"+ getCurrentHostname() + " (" + module.friendlyServerName + ")" emailText = startApplicationServerNotificationTemplate(module.name, getCurrentHostname(), guid) # Email all required parties SendEmail(emailSender, emailRecipients, emailSubject, emailText, scriptGlobals.smtpHost, scriptGlobals.smtpPort)
def __init__(self, module): ''' Constructor ''' ActionBundle.__init__(self, module) euclidModule = module.subModule guid = generateGUID() log.info("Unique ActionBundle execution ID generated: " + guid) unzippedPackagePath = createDirectoriesRecursively(scriptGlobals.workingDir + scriptGlobals.osDirSeparator + "unzippedPackage") ExtractZipToDir(module.moduleFilename, unzippedPackagePath) versionTmpPath = createDirectoriesRecursively(scriptGlobals.workingDir + scriptGlobals.osDirSeparator + "tmp") installedWarPath = module.targetDeploymentPath + scriptGlobals.osDirSeparator + "server" + scriptGlobals.osDirSeparator + module.targetDeploymentProfile + scriptGlobals.osDirSeparator + "deploy" + scriptGlobals.osDirSeparator + module.name + ".war" installedVersionInfo = getVersionInfoFromWar(installedWarPath, module.relativeVersionInformationPath, module.versionInformationRegex, module.revisionInformationRegex, versionTmpPath) newWarPath = unzippedPackagePath + scriptGlobals.osDirSeparator + "bin" + scriptGlobals.osDirSeparator + module.name + ".war" newVersionInfo = getVersionInfoFromWar(newWarPath, module.relativeVersionInformationPath, module.versionInformationRegex, module.revisionInformationRegex, versionTmpPath) print "\n------ UPDATE VERSION INFO ------" print "Currently installed: " + installedVersionInfo[0] + " (" + installedVersionInfo[1] + ")" print " To be installed: " + newVersionInfo[0] + " (" + newVersionInfo[1] + ")\n"
def __init__(self, module): ''' Constructor ''' ActionBundle.__init__(self, module) # Generate a unique ActionBundle execution id guid = generateGUID() log.info("Unique ActionBundle execution ID generated: " + guid) previousVersionBackupPath = module.subModule.previousVersionBackupPath unzippedPackagePath = module.subModule.unzippedPackagePath # Backup marketing-admin-webapp.war from deploy/ # Backup esb.jar from deploy/ # Backup ROOT.WAR/crossdmain.xml from deploy/ROOT.WAR log.info("######################## COPY ALL COPYABLE FILES ########################") for k, v in module.relativeCopyableFilesOrFolders.items(): exactLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v exactBackupLocation = module.subModule.previousVersionBackupPath + scriptGlobals.osDirSeparator + k CopyDirOrFile2(exactLocation, exactBackupLocation) # Backup marketing-suite-deployment.properties from conf # Backup mgage.properties from conf # Backup jboss-log4j.xml from conf # Backup web.xml from marketing-admin-webapp.war/WEB-INF log.info("######################## COPY ALL COPYABLE FILES ########################") for k, v in module.relativeConfigurationFiles.items(): exactLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v exactBackupLocation = previousVersionBackupPath + scriptGlobals.osDirSeparator + k CopyDirOrFile2(exactLocation, exactBackupLocation) log.info("######################## END OF COPY ########################") # Extract old MANIFEST.MF ExtractFileFromZipToDir(previousVersionBackupPath + scriptGlobals.osDirSeparator + module.subModule.relativeWarPath, module.relativeVersionInformationPath, previousVersionBackupPath) # Compare current and new versions log.info("Version currently installed : " + grepFile(module.versionInformationRegex, previousVersionBackupPath + scriptGlobals.osDirSeparator + "MANIFEST.MF")) log.info("Revision currently installed : " + grepFile(module.revisionInformationRegex, previousVersionBackupPath + scriptGlobals.osDirSeparator + "MANIFEST.MF")) log.info("Version to be installed : " + grepFile(module.versionInformationRegex, unzippedPackagePath + scriptGlobals.osDirSeparator + "MANIFEST.MF")) log.info("Revision to be installed : " + grepFile(module.revisionInformationRegex, unzippedPackagePath + scriptGlobals.osDirSeparator + "MANIFEST.MF"))
def __init__(self, module): ''' Constructor ''' guid = generateGUID() log.info("Unique ActionBundle execution ID generated: " + guid) appServer = ApplicationServer(module, scriptGlobals.appsrvProperties) pid = getProcessPIDByPathAndIdentifier(module.targetDeploymentPath, appServer.processIdentifier) if pid: log.error("Already existing process running from path '" + module.targetDeploymentPath + "' with pid '" + pid + "'.") else: # Delete all cached directories log.info("Proceeding to delete all cached folders") try: for i in appServer.relativeCacheFolders: deleteDirOrFile(module.targetDeploymentPath + scriptGlobals.osDirSeparator + i) except OSError: # If directory doesn't exist ignore the raised error pass # Change directory to run the binary from inside the binpath pwd = os.getcwd() os.chdir(module.targetDeploymentPath + appServer.binPath) runProcess("." + scriptGlobals.osDirSeparator + appServer.startCommand) os.chdir(pwd) # Construct the email notification emailSender = readPropertyFromPropertiesFileWithFallback("emailNotificationSenderAddress", scriptGlobals.scriptVarSectionName, lib.OptParser.options.envprops, scriptGlobals.emailNotificationSenderAddress) emailRecipients = module.emailNotificationRecipientList emailSubject = "Server START: " + module.name + "@"+ getCurrentHostname() + " (" + module.friendlyServerName + ")" emailText = startApplicationServerNotificationTemplate(module.name, getCurrentHostname(), guid) # Email all required parties SendEmail(emailSender, emailRecipients, emailSubject, emailText, scriptGlobals.smtpHost, scriptGlobals.smtpPort)
def __init__(self, module): ''' Constructor ''' guid = generateGUID() log.info("Unique ActionBundle execution ID generated: " + guid) appServer = ApplicationServer(module, scriptGlobals.appsrvProperties) # Construct the email notification emailSender = readPropertyFromPropertiesFileWithFallback("emailNotificationSenderAddress", scriptGlobals.scriptVarSectionName, lib.OptParser.options.envprops, scriptGlobals.emailNotificationSenderAddress) emailRecipients = module.emailNotificationRecipientList emailSubject = "Server RESTART Notification: " + module.name + "@"+ getCurrentHostname()+ " (" + module.friendlyServerName + ")" + " server will restart in " + scriptGlobals.httpServerExecutionTime + " seconds." killOperationURL = "http://" + getCurrentHostname() + ":" + str(scriptGlobals.httpServerPort) + "/stopDelayedRestart.foo" emailText = restartPendingNotificationTemplate(module.name, getCurrentHostname(), killOperationURL, guid) # Email all required parties SendEmail(emailSender, emailRecipients, emailSubject, emailText, scriptGlobals.smtpHost, scriptGlobals.smtpPort) # Start timer that will hit the timeout URL when the time ends timeoutURL = "http://" + getCurrentHostname() + ":" + str(scriptGlobals.httpServerPort) + "/timeOut.foo" timer = Timer(int(scriptGlobals.httpServerExecutionTime), timeoutURL) timer.start() # Expose cancellation URL server = launchHTTPServer(int(scriptGlobals.httpServerPort), FireworksHTTPRequestHandler) if server.result == 0: log.info("Grace period timed-out, proceeding to restart the server...") # Initialize Stop Action Bundle ab = initClassFromStringWithModule(module.moduleStopAB, module) log.info("Sleeping for 20 seconds to allow proper server stop...") time.sleep(20) # Initialize Kill Action Bundle (just in case :-)) ab = initClassFromStringWithModule(module.moduleKillAB, module) time.sleep(5) # Initialize Start Action Bundle ab = initClassFromStringWithModule(module.moduleStartAB, module) elif server.result == 1: log.info("Cancelled by external client.") timer.stop() # Construct the email notification emailSender = readPropertyFromPropertiesFileWithFallback("emailNotificationSenderAddress", scriptGlobals.scriptVarSectionName, lib.OptParser.options.envprops, scriptGlobals.emailNotificationSenderAddress) emailRecipients = module.emailNotificationRecipientList emailSubject = "Server RESTART Cancelled: " + module.name + "@"+ getCurrentHostname()+ " (" + module.friendlyServerName + ")" + " server restart was cancelled" killOperationURL = "http://" + getCurrentHostname() + ":" + str(scriptGlobals.httpServerPort) + "/stopDelayedRestart.foo" emailText = restartCancellationNotificationTemplate(module.name, getCurrentHostname(), guid) # Email all required parties SendEmail(emailSender, emailRecipients, emailSubject, emailText, scriptGlobals.smtpHost, scriptGlobals.smtpPort)
def __init__(self, module): ''' Constructor ''' ActionBundle.__init__(self, module) euclidModule = module.subModule # Generate a unique ActionBundle execution id guid = generateGUID() log.info("Unique ActionBundle execution ID generated: " + guid) # Check if JBOSS is running if getProcessPIDByPath(module.targetDeploymentPath): die("The JBOSS server at '" + module.targetDeploymentPath + "' is up. Installation will not continue") # Prepare directory to unpack package unzippedPackagePath = createDirectoriesRecursively(scriptGlobals.workingDir + scriptGlobals.osDirSeparator + "unzippedPackage") # Prepare backup directory backupPath = createDirectoriesRecursively(scriptGlobals.workingDir + scriptGlobals.osDirSeparator + "backup") # Prepare explode wars directory explodePath = createDirectoriesRecursively(scriptGlobals.workingDir + scriptGlobals.osDirSeparator + "explode") # Prepare configuration directory configDirectoryPath = createDirectoriesRecursively(euclidModule.euclidConfigDir) # Since Euclid is deployed on JBOSS some paths have an %s to allow a configurable # config dir, so do a little sprintf to fix them sprintfOnDictionaryValues(module.relativeConfigurationFiles, module.targetDeploymentProfile) sprintfOnDictionaryValues(euclidModule.relativeMergableConfigurationFiles, euclidModule.euclidConfigDir) # Since Euclid is deployed on JBOSS some paths have an %s to allow a configurable # server profile, so do a little sprintf to fix them sprintfOnDictionaryValues(module.relativeCopyableFilesOrFolders, module.targetDeploymentProfile) sprintfOnDictionaryValues(euclidModule.relativeWarsToBeExploded, module.targetDeploymentProfile) # Extract package into tmp dir ExtractZipToDir(module.moduleFilename, unzippedPackagePath) versionTmpPath = createDirectoriesRecursively(scriptGlobals.workingDir + scriptGlobals.osDirSeparator + "tmp") installedWarPath = module.targetDeploymentPath + scriptGlobals.osDirSeparator + "server" + scriptGlobals.osDirSeparator + module.targetDeploymentProfile + scriptGlobals.osDirSeparator + "deploy" + scriptGlobals.osDirSeparator + module.name + ".war" installedVersionInfo = getVersionInfoFromWar(installedWarPath, module.relativeVersionInformationPath, module.versionInformationRegex, module.revisionInformationRegex, versionTmpPath) newWarPath = unzippedPackagePath + scriptGlobals.osDirSeparator + "bin" + scriptGlobals.osDirSeparator + module.name + ".war" newVersionInfo = getVersionInfoFromWar(newWarPath, module.relativeVersionInformationPath, module.versionInformationRegex, module.revisionInformationRegex, versionTmpPath) log.info("\n------ UPDATE VERSION INFO ------------------------" + "\nCurrently installed: " + installedVersionInfo[0] + " (" + installedVersionInfo[1] + ")" + "\n To be installed: " + newVersionInfo[0] + " (" + newVersionInfo[1] + ")" + "\n---------------------------------------------------") versionSameOrNewer=False if compareVersions(newVersionInfo[0], installedVersionInfo[0]) < 0 : versionSameOrNewer=True continueOrCancel("\nWARNING: Installed version is newer! If you continue the installation DB migration will not be executed.") elif compareVersions(newVersionInfo[0], installedVersionInfo[0]) == 0 : versionSameOrNewer=True continueOrCancel("\nWARNING: Same version already installed! If you continue the installation DB migration will not be executed.") # Configure relativeConfigurationFiles for k, v in module.relativeConfigurationFiles.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k ConfigureTemplateFile(module.name, lib.OptParser.options.envprops, exactExtractedLocation) replaceInsensitiveStringInFile("${CREATE_SCHEMA}", "false", exactExtractedLocation) CheckFileConfigurationIsComplete(exactExtractedLocation) # Configure relativeMergableConfigurationFiles for k, v in euclidModule.relativeMergableConfigurationFiles.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k ConfigureTemplateFile(module.name, lib.OptParser.options.envprops, exactExtractedLocation) replaceInsensitiveStringInFile("${CREATE_SCHEMA}", "false", exactExtractedLocation) CheckFileConfigurationIsComplete(exactExtractedLocation) # Explode wars # for k, v in euclidModule.relativeWarsToBeExploded.items(): # exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k # exactTargetLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v # backupFileOrDirIfExists(exactTargetLocation,backupPath) # ExtractZipToDir(exactExtractedLocation, exactTargetLocation) for k, v in euclidModule.relativeWarsToBeExploded.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k i = rfind(k, scriptGlobals.osDirSeparator) if i > -1: tmpExplodeWarLocation = explodePath + scriptGlobals.osDirSeparator + k[i+1:] else: tmpExplodeWarLocation = explodePath + scriptGlobals.osDirSeparator + k exactTargetLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v backupFileOrDirIfExists(exactTargetLocation,backupPath) createDirectoriesRecursively(tmpExplodeWarLocation) ExtractZipToDir(exactExtractedLocation, tmpExplodeWarLocation) AltMoveDirOrFile(tmpExplodeWarLocation,exactTargetLocation) # Copy config files for k, v in module.relativeConfigurationFiles.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k exactTargetLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v backupFileOrDirIfExists(exactTargetLocation,backupPath) CopyDirOrFile(exactExtractedLocation, exactTargetLocation) # Copy merge config files and copy (just copy for now) for k, v in euclidModule.relativeMergableConfigurationFiles.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k exactTargetLocation = v backupFileOrDirIfExists(exactTargetLocation,backupPath) CopyDirOrFile(exactExtractedLocation, exactTargetLocation) # secondaryFileName = unzippedPackagePath + scriptGlobals.osDirSeparator + k # mergedFileName = secondaryFileName+".merged" # primaryFileName = v # MergeSectionlessConfigFiles(primaryFileName, secondaryFileName, mergedFileName) # CopyDirOrFile(mergedFileName, primaryFileName) # Copy other files for k, v in module.relativeCopyableFilesOrFolders.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k exactTargetLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v backupFileOrDirIfExists(exactTargetLocation,backupPath) CopyDirOrFile(exactExtractedLocation, exactTargetLocation) #Construct DB connection string if versionSameOrNewer: log.info("Skipping DB migration scripts execution!") return dbUsername = readPropertyFromPropertiesFile("DB_CONNECTION_USERNAME", module.name, lib.OptParser.options.envprops) dbPassword = readPropertyFromPropertiesFile("DB_CONNECTION_PASSWORD", module.name, lib.OptParser.options.envprops) connUrl = readPropertyFromPropertiesFile("DB_CONNECTION_URL", module.name, lib.OptParser.options.envprops) finalConnectionString = string.replace(connUrl, '@', dbUsername + '/' + dbPassword + '@', 1) # Execute DB migration scripts confParser = ConfigParser.ConfigParser() confParser.read(unzippedPackagePath + scriptGlobals.osDirSeparator + euclidModule.relativeDatabaseUpgrateDescriptionFilePath) ok, scripts, default = getDbUpdateScriptsToRun(installedVersionInfo[0], confParser) if ok == False: continueOrCancel("\nERROR: This installer does not support updating from " + installedVersionInfo[0] + " version!") elif len(default)>0: log.info('DB update scripts to be executed:\n' + string.join(scripts, ", ")) continueOrCancel("\nWARNING: Default DB update scripts are used for branch(es) " + string.join(default,", ") + ". This is probably probably OK, but you should make sure that the currently installed version is supported by the update procedure (please read the deployment instructions or consult with the development team).") else: log.info('DB update scripts to be executed:\n' + string.join(scripts, ", ")) baseDbScriptPath = unzippedPackagePath + scriptGlobals.osDirSeparator + module.relativeDatabaseUpgradeFilePath + scriptGlobals.osDirSeparator for script in scripts: #print "Execute: " + baseDbScriptPath + script RunOracleScriptFromFile(baseDbScriptPath + script, finalConnectionString)
def __init__(self, module): ''' Constructor ''' ActionBundle.__init__(self, module) euclidModule = module.subModule # Generate a unique ActionBundle execution id guid = generateGUID() log.info("Unique ActionBundle execution ID generated: " + guid) # Check if JBOSS is running if getProcessPIDByPath(module.targetDeploymentPath): die("The JBOSS server at '" + module.targetDeploymentPath + "' is up. Installation will not continue") # Prepare directory to unpack package unzippedPackagePath = createDirectoriesRecursively(scriptGlobals.workingDir + scriptGlobals.osDirSeparator + "unzippedPackage") # Prepare backup directory backupPath = createDirectoriesRecursively(scriptGlobals.workingDir + scriptGlobals.osDirSeparator + "backup") # Prepare explode wars directory explodePath = createDirectoriesRecursively(scriptGlobals.workingDir + scriptGlobals.osDirSeparator + "explode") # Prepare configuration directory configDirectoryPath = createDirectoriesRecursively(euclidModule.euclidConfigDir) # Since Euclid is deployed on JBOSS some paths have an %s to allow a configurable # config dir, so do a little sprintf to fix them sprintfOnDictionaryValues(module.relativeConfigurationFiles, module.targetDeploymentProfile) sprintfOnDictionaryValues(euclidModule.relativeMergableConfigurationFiles, euclidModule.euclidConfigDir) # Since Euclid is deployed on JBOSS some paths have an %s to allow a configurable # server profile, so do a little sprintf to fix them sprintfOnDictionaryValues(module.relativeCopyableFilesOrFolders, module.targetDeploymentProfile) sprintfOnDictionaryValues(euclidModule.relativeWarsToBeExploded, module.targetDeploymentProfile) # Extract package into tmp dir ExtractZipToDir(module.moduleFilename, unzippedPackagePath) # Configure relativeConfigurationFiles for k, v in module.relativeConfigurationFiles.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k ConfigureTemplateFile(module.name, lib.OptParser.options.envprops, exactExtractedLocation) replaceInsensitiveStringInFile("${CREATE_SCHEMA}", "true", exactExtractedLocation) CheckFileConfigurationIsComplete(exactExtractedLocation) # Configure relativeMergableConfigurationFiles for k, v in euclidModule.relativeMergableConfigurationFiles.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k ConfigureTemplateFile(module.name, lib.OptParser.options.envprops, exactExtractedLocation) replaceInsensitiveStringInFile("${CREATE_SCHEMA}", "true", exactExtractedLocation) CheckFileConfigurationIsComplete(exactExtractedLocation) # Explode wars # for k, v in euclidModule.relativeWarsToBeExploded.items(): # exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k # exactTargetLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v # backupFileOrDirIfExists(exactTargetLocation,backupPath) # ExtractZipToDir(exactExtractedLocation, exactTargetLocation) for k, v in euclidModule.relativeWarsToBeExploded.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k i = rfind(k, scriptGlobals.osDirSeparator) if i > -1: tmpExplodeWarLocation = explodePath + scriptGlobals.osDirSeparator + k[i+1:] else: tmpExplodeWarLocation = explodePath + scriptGlobals.osDirSeparator + k exactTargetLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v backupFileOrDirIfExists(exactTargetLocation,backupPath) createDirectoriesRecursively(tmpExplodeWarLocation) ExtractZipToDir(exactExtractedLocation, tmpExplodeWarLocation) AltMoveDirOrFile(tmpExplodeWarLocation,exactTargetLocation) # Copy config files for k, v in module.relativeConfigurationFiles.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k exactTargetLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v backupFileOrDirIfExists(exactTargetLocation,backupPath) CopyDirOrFile(exactExtractedLocation, exactTargetLocation) # Copy mergable config files (no need to merge on clean install) for k, v in euclidModule.relativeMergableConfigurationFiles.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k exactTargetLocation = v backupFileOrDirIfExists(exactTargetLocation,backupPath) CopyDirOrFile(exactExtractedLocation, exactTargetLocation) # Copy other files for k, v in module.relativeCopyableFilesOrFolders.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k exactTargetLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v backupFileOrDirIfExists(exactTargetLocation,backupPath) CopyDirOrFile(exactExtractedLocation, exactTargetLocation)
lock = acquireLock(scriptGlobals.lockFile, True) # Measure execution time startTime = time.time() # Print Fireworks execution command log.debug("Fireworks execution command '" + " ".join(sys.argv) + "'") # Print cool header :-) log.info(fireworksAsciiHeader(scriptGlobals.version, scriptGlobals.revision, scriptGlobals.buildDate)) # Print OS information printOsInformation() # Generate a unique ActionBundle execution id guid = generateGUID() log.info("Unique Fireworks Execution ID generated: '" + guid + "'") # Initialize working dir scriptGlobals.workingDir = scriptGlobals.workingDir % (parser.options.action, guid) # Create it createDirectoriesRecursively(scriptGlobals.workingDir) log.info("Working directory '" + scriptGlobals.workingDir + "'") # Start per-execution logger log.addHandler(createCustomLogger(scriptGlobals.workingDir + scriptGlobals.osDirSeparator + guid + ".log", scriptGlobals.customLoggingFormat, logging.DEBUG)) # Get Module Properties file isRequiredFileEmpty(parser.options.module) moduleProperties = extractFileFromZipToDir(parser.options.module, scriptGlobals.modulePropertiesFile, scriptGlobals.workingDir)
def __init__(self, module): ''' Constructor ''' ActionBundle.__init__(self, module) # Generate a unique ActionBundle execution id guid = generateGUID() log.info("Unique ActionBundle execution ID generated: " + guid) # Check if standalone is running if getProcessPIDByPathAndIdentifier(module.targetDeploymentPath, module.subModule.processIdentifier): die("\n\nThe " + module.subModule.name + " server at '" + module.targetDeploymentPath + "' is up. Configuration will not continue\n") # Check if module is already installed for k, v in module.relativeCopyableFilesOrFolders.items(): exactLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v if not os.path.isdir(exactLocation): die(module.subModule.name + " is Not already installed to:" + module.targetDeploymentPath + ". Maybe you want to make a clean Installation !!") # Get Previous Hudson data previousManifilePath = module.targetDeploymentPath + scriptGlobals.osDirSeparator + module.subModule.name + scriptGlobals.osDirSeparator + "META-INF" + scriptGlobals.osDirSeparator + "MANIFEST.MF" previousVersionInfo = grepFile(module.versionInformationRegex, previousManifilePath) previousBuildInfo = grepFile(module.buildInformationRegex, previousManifilePath) previousRevisionInfo = grepFile(module.revisionInformationRegex, previousManifilePath) previousVersionInfo = (previousVersionInfo.replace(module.versionInformationRegex, "")).strip() if previousBuildInfo != None: previousBuildInfo = (previousBuildInfo.replace(module.buildInformationRegex, "")).strip() previousRevisionInfo = (previousRevisionInfo.replace(module.revisionInformationRegex, "")).strip() # Prepare directory to keep backups previousVersionBackupPath = createDirectoriesRecursively(scriptGlobals.workingDir + scriptGlobals.osDirSeparator + "previousVersionBackup") # Backup standalone for k, v in module.relativeCopyableFilesOrFolders.items(): exactLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v exactBackupLocation = previousVersionBackupPath + scriptGlobals.osDirSeparator + k CopyDirOrFile3(exactLocation, exactBackupLocation) # if exactLocation.find(module.subModule.name) != -1 : # DeleteDirOrFile(exactLocation) # Prepare directory to unpack package unzippedPackagePath = createDirectoriesRecursively(scriptGlobals.workingDir + scriptGlobals.osDirSeparator + "unzippedPackage") # Extract MSM package into tmp dir ExtractZipToDir(module.moduleFilename, unzippedPackagePath) filenameToExtract = "META-INF/MANIFEST.MF" zipFilename = unzippedPackagePath + "/bin/" + module.subModule.name + "/lib/" + module.subModule.name +".jar" location = unzippedPackagePath + "/bin/" + module.subModule.name + "/META-INF" ExtractFileFromZipToDir(zipFilename, filenameToExtract, location) # Configure xxx.properties in tmp/../conf using envprops for k, v in module.relativeConfigurationFiles.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k ConfigureTemplateFile(module.name, lib.OptParser.options.envprops, exactExtractedLocation) CheckFileConfigurationIsComplete(exactExtractedLocation) # Copy tmp/../conf/xxx.properties to to specified locations on Server (values) for k, v in module.relativeConfigurationFiles.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k exactTargetLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v CopyDirOrFile(exactExtractedLocation, exactTargetLocation) # Construct the email notification emailSender = readPropertyFromPropertiesFileWithFallback("emailNotificationSenderAddress", scriptGlobals.scriptVarSectionName, lib.OptParser.options.envprops, scriptGlobals.emailNotificationSenderAddress) emailRecipients = scriptGlobals.globalNotificationEmailList emailSubject = "MSM Installation: " + module.name + "@"+ getCurrentHostname() + " (" + module.friendlyServerName + ")" emailText = detailedUpdateInstallationReportTemplate(module.subModule.name, previousVersionInfo, lib.OptParser.options.action, getCurrentHostname(), os.getcwd(), guid, " ".join(platform.uname()), getpass.getuser(), previousBuildInfo, previousRevisionInfo, lib.OptParser.options.envprops, previousVersionInfo, previousBuildInfo, previousRevisionInfo, scriptGlobals.workingDir) # Email all required parties SendEmail(emailSender, emailRecipients, emailSubject, emailText, scriptGlobals.smtpHost, scriptGlobals.smtpPort)
def __init__(self, module): ''' Constructor ''' ActionBundle.__init__(self, module) # Initialize application server object # appServer = ApplicationServer(module, scriptGlobals.appsrvProperties) # Generate a unique ActionBundle execution id guid = generateGUID() log.info("Unique ActionBundle execution ID generated: " + guid) # Check if standalone is running if getProcessPIDByPathAndIdentifier(module.targetDeploymentPath, module.subModule.processIdentifier): die("\n\nThe " + module.subModule.name + " server at '" + module.targetDeploymentPath + "' is up. Installation will not continue\n") exists="true" # Check if module is already installed for k, v in module.relativeCopyableFilesOrFolders.items(): exactLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v if not os.path.isdir(exactLocation): exists = "false" #die(module.subModule.name + " is Not already installed to:" + module.targetDeploymentPath + ". Maybe you want to make a clean Installation !!") previousVersionInfo="" previousBuildInfo="" previousRevisionInfo="" if (exists == "true"): # Get Previous Hudson data previousManifilePath = module.targetDeploymentPath + scriptGlobals.osDirSeparator + module.subModule.name + scriptGlobals.osDirSeparator + "META-INF" + scriptGlobals.osDirSeparator + "MANIFEST.MF" previousVersionInfo = grepFile(module.versionInformationRegex, previousManifilePath) previousBuildInfo = grepFile(module.buildInformationRegex, previousManifilePath) previousRevisionInfo = grepFile(module.revisionInformationRegex, previousManifilePath) previousVersionInfo = (previousVersionInfo.replace(module.versionInformationRegex, "")).strip() previousRevisionInfo = (previousRevisionInfo.replace(module.revisionInformationRegex, "")).strip() if previousBuildInfo != None: previousBuildInfo = (previousBuildInfo.replace(module.buildInformationRegex, "")).strip() # Prepare directory to keep backups previousVersionBackupPath = createDirectoriesRecursively(scriptGlobals.workingDir + scriptGlobals.osDirSeparator + "previousVersionBackup") # Backup standalone if (lib.OptParser.action !="install-nodb-nobackup" and exists == "true"): for k, v in module.relativeCopyableFilesOrFolders.items(): exactLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v exactBackupLocation = previousVersionBackupPath + scriptGlobals.osDirSeparator + k CopyDirOrFile3(exactLocation, exactBackupLocation) if exactLocation.find(module.subModule.name) != -1 : DeleteDirOrFile(exactLocation) # Prepare directory to unpack package unzippedPackagePath = createDirectoriesRecursively(scriptGlobals.workingDir + scriptGlobals.osDirSeparator + "unzippedPackage") # Extract MSM package into tmp dir ExtractZipToDir(module.moduleFilename, unzippedPackagePath) # CreateDirectory(unzippedPackagePath + "/bin/" + module.subModule.name) # ExtractZipToDir(unzippedPackagePath + "/bin/" + module.subModule.name + ".war", unzippedPackagePath + "/bin/" + module.subModule.name) filenameToExtract = "META-INF/MANIFEST.MF" zipFilename = unzippedPackagePath + "/bin/" + module.subModule.name + "/lib/" + module.subModule.name +".jar" location = unzippedPackagePath + "/bin/" + module.subModule.name + "/META-INF" ExtractFileFromZipToDir(zipFilename, filenameToExtract, location) # Configure xxx.properties in tmp/../conf using envprops for k, v in module.relativeConfigurationFiles.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k ConfigureTemplateFile(module.name, lib.OptParser.options.envprops, exactExtractedLocation) CheckFileConfigurationIsComplete(exactExtractedLocation) # Copy relativeCopyableFilesOrFolders to specified locations on Server (values) for k, v in module.relativeCopyableFilesOrFolders.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k exactTargetLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v CopyDirOrFile(exactExtractedLocation, exactTargetLocation) # Copy tmp/../conf/xxx.properties to to specified locations on Server (values) for k, v in module.relativeConfigurationFiles.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k exactTargetLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v CopyDirOrFile(exactExtractedLocation, exactTargetLocation) if (module.subModule.name == "mrouter"): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + module._locations['relativeStartupScript'] ChangePathPermissions(exactExtractedLocation, 0777) CopyDirOrFile2(exactExtractedLocation, module.targetDeploymentPath) path1 = module.targetDeploymentPath + "/" + module.subModule.name + "/bin" ChangePathPermissions(path1, 0744) # Find version/revision info versionInfo = grepFile(module.versionInformationRegex, unzippedPackagePath + scriptGlobals.osDirSeparator + module.relativeVersionInformationPath) versionInfo = (versionInfo.replace(module.versionInformationRegex, "")).strip() revisionInfo = grepFile(module.revisionInformationRegex, unzippedPackagePath + scriptGlobals.osDirSeparator + module.relativeVersionInformationPath) revisionInfo = (revisionInfo.replace(module.revisionInformationRegex, "")).strip() buildInfo = grepFile(module.buildInformationRegex, unzippedPackagePath + scriptGlobals.osDirSeparator + module.relativeVersionInformationPath) if buildInfo != None: buildInfo = (buildInfo.replace(module.buildInformationRegex, "")).strip() if (lib.OptParser.action == "install-update" or lib.OptParser.action == "_customUpgrade"): moduleDeployPath = module.targetDeploymentPath + "/" + module.subModule.name path1 = moduleDeployPath + "/bin" ChangePathPermissions(path1, 0744) path2 = moduleDeployPath + "/" + module.subModule.installUpdateScript if (lib.OptParser.action == "_customUpgrade"): path2=path2 + " UPGRADE YES " else: path2=path2 + " UPDATE YES " ExecuteOSCommand(path2, None) # Construct the email notification emailSender = readPropertyFromPropertiesFileWithFallback("emailNotificationSenderAddress", scriptGlobals.scriptVarSectionName, lib.OptParser.options.envprops, scriptGlobals.emailNotificationSenderAddress) emailRecipients = scriptGlobals.globalNotificationEmailList emailSubject = "MSM Installation: " + module.name + "@"+ getCurrentHostname() + " (" + module.friendlyServerName + ")" emailText = detailedUpdateInstallationReportTemplate(module.subModule.name, versionInfo, lib.OptParser.options.action, getCurrentHostname(), os.getcwd(), guid, " ".join(platform.uname()), getpass.getuser(), buildInfo, revisionInfo, lib.OptParser.options.envprops, previousVersionInfo, previousBuildInfo, previousRevisionInfo, scriptGlobals.workingDir) # Email all required parties SendEmail(emailSender, emailRecipients, emailSubject, emailText, scriptGlobals.smtpHost, scriptGlobals.smtpPort)
def __init__(self, module): """ Constructor """ ActionBundle.__init__(self, module) # Initialize application server object appServer = ApplicationServer(module, scriptGlobals.appsrvProperties) # Generate a unique ActionBundle execution id guid = generateGUID() log.info("Unique ActionBundle execution ID generated: " + guid) # Since MSM is deployed on JBOSS some paths have an %s to allow a configurable # profile, so do a little sprintf to fix them sprintfOnDictionaryValues(module.relativeConfigurationFiles, module.targetDeploymentProfile) sprintfOnDictionaryValues(module.relativeCopyableFilesOrFolders, module.targetDeploymentProfile) # For JbosswebappPath = "/server/" + module.targetDeploymentProfile + "/deploy/" + module.subModule.name + ".war" # for Tomcat webappPath = "/webapps/" + module.subModule.name webappPath = "/webapps/" + module.subModule.name # Check if module exists. for k, v in module.relativeCopyableFilesOrFolders.items(): exactTargetLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v if exactTargetLocation.find(webappPath) != -1: if not os.path.isdir(exactTargetLocation): die( "\n\n" + module.subModule.name + " is not installed under:" + module.targetDeploymentPath + ". Please first run a clean installation" ) # Get Previous Hudson data previousManifilePath = module.targetDeploymentPath + webappPath + "/META-INF/MANIFEST.MF" previousVersionInfo = grepFile(module.versionInformationRegex, previousManifilePath) previousBuildInfo = grepFile(module.buildInformationRegex, previousManifilePath) previousRevisionInfo = grepFile(module.revisionInformationRegex, previousManifilePath) previousRevisionInfo = (previousRevisionInfo.replace(module.revisionInformationRegex, "")).strip() previousVersionInfo = (previousVersionInfo.replace(module.versionInformationRegex, "")).strip() if previousBuildInfo != None: previousBuildInfo = (previousBuildInfo.replace(module.buildInformationRegex, "")).strip() # Construct the email notification emailSender = readPropertyFromPropertiesFileWithFallback( "emailNotificationSenderAddress", scriptGlobals.scriptVarSectionName, lib.OptParser.options.envprops, scriptGlobals.emailNotificationSenderAddress, ) emailRecipients = scriptGlobals.globalNotificationEmailList emailSubject = ( "MSM Installation: " + module.subModule.name + "@" + getCurrentHostname() + " (" + module.friendlyServerName + ")" ) emailText = detailedCleanInstallationReportTemplate( module.subModule.name, previousVersionInfo, lib.OptParser.options.action, getCurrentHostname(), os.getcwd(), guid, " ".join(platform.uname()), getpass.getuser(), previousBuildInfo, previousRevisionInfo, lib.OptParser.options.envprops, scriptGlobals.workingDir, ) # Email all required parties SendEmail(emailSender, emailRecipients, emailSubject, emailText, scriptGlobals.smtpHost, scriptGlobals.smtpPort)
def __init__(self, module): """ Constructor """ ActionBundle.__init__(self, module) # Initialize application server object appServer = ApplicationServer(module, scriptGlobals.appsrvProperties) # Generate a unique ActionBundle execution id guid = generateGUID() log.info("Unique ActionBundle execution ID generated: " + guid) # Check if Tomcat is running if getProcessPIDByPathAndIdentifier(module.targetDeploymentPath, appServer.processIdentifier): die("\n\nThe Jboss server at '" + module.targetDeploymentPath + "' is up. Installation will not continue") # Since MSM is deployed on JBOSS some paths have an %s to allow a configurable # profile, so do a little sprintf to fix them sprintfOnDictionaryValues(module.relativeConfigurationFiles, module.targetDeploymentProfile) sprintfOnDictionaryValues(module.relativeCopyableFilesOrFolders, module.targetDeploymentProfile) # For JbosswebappPath = "/server/" + module.targetDeploymentProfile + "/deploy/" + module.subModule.name + ".war" # for Tomcat webappPath = "/webapps/" + module.subModule.name webappPath = "/webapps/" + module.subModule.name # Check if module exists. for k, v in module.relativeCopyableFilesOrFolders.items(): exactTargetLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v if exactTargetLocation.find(webappPath) != -1: if os.path.isdir(exactTargetLocation): log.info( "\n##############################################################\n" + module.subModule.name + " is already installed under:" + module.targetDeploymentPath + ". Please manually backup and remove to run a clean installation (unless you want to update)\n##############################################################" ) die() # Prepare directory to unpack package unzippedPackagePath = createDirectoriesRecursively( scriptGlobals.workingDir + scriptGlobals.osDirSeparator + "unzippedPackage" ) # Extract MSM package into tmp dir ExtractZipToDir(module.moduleFilename, unzippedPackagePath) CreateDirectory(unzippedPackagePath + "/bin/" + module.subModule.name) ExtractZipToDir( unzippedPackagePath + "/bin/" + module.subModule.name + ".war", unzippedPackagePath + "/bin/" + module.subModule.name, ) # Configure xxx.properties in tmp/../conf using envprops for k, v in module.relativeConfigurationFiles.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k ConfigureTemplateFile(module.name, lib.OptParser.options.envprops, exactExtractedLocation) CheckFileConfigurationIsComplete(exactExtractedLocation) # Copy relativeCopyableFilesOrFolders to specified locations on Server (values) for k, v in module.relativeCopyableFilesOrFolders.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k exactTargetLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v CopyDirOrFile(exactExtractedLocation, exactTargetLocation) # Copy tmp/../conf/xxx.properties to to specified locations on Server (values) for k, v in module.relativeConfigurationFiles.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k exactTargetLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v CopyDirOrFile(exactExtractedLocation, exactTargetLocation) # Find version/revision info revisionInfo = grepFile( module.revisionInformationRegex, unzippedPackagePath + scriptGlobals.osDirSeparator + module.relativeVersionInformationPath, ) revisionInfo = (revisionInfo.replace(module.revisionInformationRegex, "")).strip() versionInfo = grepFile( module.versionInformationRegex, unzippedPackagePath + scriptGlobals.osDirSeparator + module.relativeVersionInformationPath, ) versionInfo = (versionInfo.replace(module.versionInformationRegex, "")).strip() buildInfo = grepFile( module.buildInformationRegex, unzippedPackagePath + scriptGlobals.osDirSeparator + module.relativeVersionInformationPath, ) if buildInfo != None: buildInfo = (buildInfo.replace(module.buildInformationRegex, "")).strip() # Run CREATE/UPDATE/UPGRADE script if module.subModule.installUpdateScript != "": path1 = module.targetDeploymentPath + webappPath + "/" + module.subModule.installUpdateScript ChangePathPermissions(path1, 0744) path1 = path1 + " CREATE YES " ExecuteOSCommand(path1, None) # Construct the email notification emailSender = readPropertyFromPropertiesFileWithFallback( "emailNotificationSenderAddress", scriptGlobals.scriptVarSectionName, lib.OptParser.options.envprops, scriptGlobals.emailNotificationSenderAddress, ) emailRecipients = scriptGlobals.globalNotificationEmailList emailSubject = ( "MSM Installation: " + module.subModule.name + "@" + getCurrentHostname() + " (" + module.friendlyServerName + ")" ) emailText = detailedCleanInstallationReportTemplate( module.subModule.name, versionInfo, lib.OptParser.options.action, getCurrentHostname(), os.getcwd(), guid, " ".join(platform.uname()), getpass.getuser(), buildInfo, revisionInfo, lib.OptParser.options.envprops, scriptGlobals.workingDir, ) # Email all required parties SendEmail(emailSender, emailRecipients, emailSubject, emailText, scriptGlobals.smtpHost, scriptGlobals.smtpPort)
def __init__(self, module): """ Constructor """ ActionBundle.__init__(self, module) # Initialize application server object appServer = ApplicationServer(module, scriptGlobals.appsrvProperties) # Generate a unique ActionBundle execution id guid = generateGUID() log.info("Unique ActionBundle execution ID generated: " + guid) # Check if Tomcat is running if getProcessPIDByPathAndIdentifier(module.targetDeploymentPath, appServer.processIdentifier): die("\n\nThe Jboss server at '" + module.targetDeploymentPath + "' is up. Installation will not continue") # Since MSM is deployed on JBOSS some paths have an %s to allow a configurable # profile, so do a little sprintf to fix them sprintfOnDictionaryValues(module.relativeConfigurationFiles, module.targetDeploymentProfile) sprintfOnDictionaryValues(module.relativeCopyableFilesOrFolders, module.targetDeploymentProfile) # For JbosswebappPath = "/server/" + module.targetDeploymentProfile + "/deploy/" + module.subModule.name + ".war" # for Tomcat webappPath = "/webapps/" + module.subModule.name webappPath = "/webapps/" + module.subModule.name # Check if module exists. for k, v in module.relativeCopyableFilesOrFolders.items(): exactTargetLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v if exactTargetLocation.find(webappPath) != -1: if not os.path.isdir(exactTargetLocation): die( "\n\n" + module.subModule.name + " is not installed under:" + module.targetDeploymentPath + ". Please first run a clean installation" ) # Get Previous Hudson data previousManifilePath = module.targetDeploymentPath + webappPath + "/META-INF/MANIFEST.MF" previousVersionInfo = grepFile(module.versionInformationRegex, previousManifilePath) previousBuildInfo = grepFile(module.buildInformationRegex, previousManifilePath) previousRevisionInfo = grepFile(module.revisionInformationRegex, previousManifilePath) previousVersionInfo = (previousVersionInfo.replace(module.versionInformationRegex, "")).strip() if previousBuildInfo != None: previousBuildInfo = (previousBuildInfo.replace(module.buildInformationRegex, "")).strip() previousRevisionInfo = (previousRevisionInfo.replace(module.revisionInformationRegex, "")).strip() # Prepare directory to keep backups previousVersionBackupPath = createDirectoriesRecursively( scriptGlobals.workingDir + scriptGlobals.osDirSeparator + "previousVersionBackup" ) # Backup webapps if lib.OptParser.action != "install-nodb-nobackup": for k, v in module.relativeCopyableFilesOrFolders.items(): exactLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v exactBackupLocation = previousVersionBackupPath + scriptGlobals.osDirSeparator + k CopyDirOrFile3(exactLocation, exactBackupLocation) # Prepare directory to unpack package unzippedPackagePath = createDirectoriesRecursively( scriptGlobals.workingDir + scriptGlobals.osDirSeparator + "unzippedPackage" ) # Extract MSM package into tmp dir ExtractZipToDir(module.moduleFilename, unzippedPackagePath) CreateDirectory(unzippedPackagePath + "/bin/" + module.subModule.name) ExtractZipToDir( unzippedPackagePath + "/bin/" + module.subModule.name + ".war", unzippedPackagePath + "/bin/" + module.subModule.name, ) # Configure xxx.properties in tmp/../conf using envprops for k, v in module.relativeConfigurationFiles.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k ConfigureTemplateFile(module.name, lib.OptParser.options.envprops, exactExtractedLocation) CheckFileConfigurationIsComplete(exactExtractedLocation) # Copy tmp/../conf/xxx.properties to to specified locations on Server (values) for k, v in module.relativeConfigurationFiles.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k exactTargetLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v CopyDirOrFile(exactExtractedLocation, exactTargetLocation) # Construct the email notification emailSender = readPropertyFromPropertiesFileWithFallback( "emailNotificationSenderAddress", scriptGlobals.scriptVarSectionName, lib.OptParser.options.envprops, scriptGlobals.emailNotificationSenderAddress, ) emailRecipients = scriptGlobals.globalNotificationEmailList emailSubject = ( "MSM Installation: " + module.subModule.name + "@" + getCurrentHostname() + " (" + module.friendlyServerName + ")" ) emailText = detailedUpdateInstallationReportTemplate( module.subModule.name, previousVersionInfo, lib.OptParser.options.action, getCurrentHostname(), os.getcwd(), guid, " ".join(platform.uname()), getpass.getuser(), previousBuildInfo, previousRevisionInfo, lib.OptParser.options.envprops, previousVersionInfo, previousBuildInfo, previousRevisionInfo, scriptGlobals.workingDir, ) # Email all required parties SendEmail(emailSender, emailRecipients, emailSubject, emailText, scriptGlobals.smtpHost, scriptGlobals.smtpPort)
def __init__(self, module): ''' Constructor ''' ActionBundle.__init__(self, module) # Initialize application server object # appServer = ApplicationServer(module, scriptGlobals.appsrvProperties) # Generate a unique ActionBundle execution id guid = generateGUID() log.info("Unique ActionBundle execution ID generated: " + guid) # Check if Server is running if getProcessPIDByPathAndIdentifier(module.targetDeploymentPath, module.subModule.processIdentifier): die("\n\nThe " + module.subModule.name + " server at '" + module.targetDeploymentPath + "' is up. Installation will not continue\n") # Check if module exists. for k, v in module.relativeCopyableFilesOrFolders.items(): exactTargetLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v if os.path.isdir(exactTargetLocation): log.info("\n###############################################################################################\n" + module.subModule.name + " is already installed under:" + module.targetDeploymentPath + ". Please manually backup and remove to run a clean installation (unless you want to update)\n###############################################################################################") die() # Prepare directory to unpack package unzippedPackagePath = createDirectoriesRecursively(scriptGlobals.workingDir + scriptGlobals.osDirSeparator + "unzippedPackage") # Extract MSM package into tmp dir ExtractZipToDir(module.moduleFilename, unzippedPackagePath) filenameToExtract = "META-INF/MANIFEST.MF" zipFilename = unzippedPackagePath + "/bin/" + module.subModule.name + "/lib/" + module.subModule.name +".jar" location = unzippedPackagePath + "/bin/" + module.subModule.name + "/META-INF" ExtractFileFromZipToDir(zipFilename, filenameToExtract, location) # Configure xxx.properties in tmp/../conf using envprops for k, v in module.relativeConfigurationFiles.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k ConfigureTemplateFile(module.name, lib.OptParser.options.envprops, exactExtractedLocation) CheckFileConfigurationIsComplete(exactExtractedLocation) # Copy relativeCopyableFilesOrFolders to specified locations on Server (values) for k, v in module.relativeCopyableFilesOrFolders.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k exactTargetLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v CopyDirOrFile(exactExtractedLocation, exactTargetLocation) # Copy tmp/../conf/xxx.properties to to specified locations on Server (values) for k, v in module.relativeConfigurationFiles.items(): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + k exactTargetLocation = module.targetDeploymentPath + scriptGlobals.osDirSeparator + v CopyDirOrFile(exactExtractedLocation, exactTargetLocation) if (module.subModule.name == "mrouter"): exactExtractedLocation = unzippedPackagePath + scriptGlobals.osDirSeparator + module._locations['relativeStartupScript'] ChangePathPermissions(exactExtractedLocation, 0777) CopyDirOrFile2(exactExtractedLocation, module.targetDeploymentPath) # Find version/revision info versionInfo = grepFile(module.versionInformationRegex, unzippedPackagePath + scriptGlobals.osDirSeparator + module.relativeVersionInformationPath) versionInfo = (versionInfo.replace(module.versionInformationRegex, "")).strip() revisionInfo = grepFile(module.revisionInformationRegex, unzippedPackagePath + scriptGlobals.osDirSeparator + module.relativeVersionInformationPath) revisionInfo = (revisionInfo.replace(module.revisionInformationRegex, "")).strip() buildInfo = grepFile(module.buildInformationRegex, unzippedPackagePath + scriptGlobals.osDirSeparator + module.relativeVersionInformationPath) if buildInfo != None: buildInfo = (buildInfo.replace(module.buildInformationRegex, "")).strip() moduleDeployPath = module.targetDeploymentPath + "/" + module.subModule.name path1 = moduleDeployPath + "/bin" ChangePathPermissions(path1, 0744) path2 = moduleDeployPath + "/" + module.subModule.installUpdateScript path2=path2 + " CREATE YES " ExecuteOSCommand(path2, None) ##ExecuteOSCommandAndCaptureOutput(path1,"ERROR", None, None) ##THIS ExecuteOSCommand(path1, None) ##ExecuteOSCommandAndCaptureOutput("cd " + path1, None, None) # Construct the email notification emailSender = readPropertyFromPropertiesFileWithFallback("emailNotificationSenderAddress", scriptGlobals.scriptVarSectionName, lib.OptParser.options.envprops, scriptGlobals.emailNotificationSenderAddress) emailRecipients = scriptGlobals.globalNotificationEmailList emailSubject = "MSM Installation: " + module.name + "@"+ getCurrentHostname() + " (" + module.friendlyServerName + ")" emailText = detailedCleanInstallationReportTemplate(module.subModule.name, versionInfo, lib.OptParser.options.action, getCurrentHostname(), os.getcwd(), guid, " ".join(platform.uname()), getpass.getuser(), buildInfo, revisionInfo, lib.OptParser.options.envprops, scriptGlobals.workingDir) # Email all required parties SendEmail(emailSender, emailRecipients, emailSubject, emailText, scriptGlobals.smtpHost, scriptGlobals.smtpPort)