def syncRippleStartDone(distDir, wasRoot): applicationModels = getApplications(distDir, "*.xml.done") applicationModels.extend(getApplications(distDir, "*.xml.confirmed")) calculateAffectedNodes("update", wasRoot, applicationModels) PreValidateNodesAndServers(Globals.uniqueNodesContainedServers) syncRippleStart("update", applicationModels) configSave()
def installOrUpdate(action, distDir, wasRoot): log(VERBOSE_, "installOrUpdate: " + action + " " + distDir) log(VERBOSE_, "installOrUpdate: " + wasRoot + " ...") applicationModels = getApplications(distDir) ################## PRE-VALIDATE Application TARGETS+SETTINGS files #################### if action == "install": PreValidateApplicationsAbsent(applicationModels) else: PreValidateApplicationsExist(applicationModels) #endElse ############### CALCULATE AFFECTED NODES #################### calculateAffectedNodes(action, wasRoot, applicationModels) ################## PRE-VALIDATE NODES and SERVERS #################### PreValidateNodesAndServers(Globals.uniqueNodesContainedServers) ############### PREPARE AFFECTED NODES #################### #if ((action == "update")): # Globals.nodesAutosyncs = saveAndDisableAutosync(action, Globals.uniqueNodesContainedServers) # log(INFO_, "installOrUpdate: RESULT: nodesAutosyncs="+`Globals.nodesAutosyncs`) #endIf ############### INSTALL APPLICATION AND CONFIGURE #################### applicationModels = installAndConfigureApps(action, distDir, wasRoot, applicationModels) calculateAffectedNodes(action, wasRoot, applicationModels) for item in Globals.appsNodesServers: for nodeServer in item[1]: nodeName = nodeServer.nodeName serverName = nodeServer.serverName if len(nodeServer.jvmAttributes) > 0: jvmAttributes = [] for jvmAttribute in nodeServer.jvmAttributes: log(INFO_, "jvmAttribute " + nodeName + ":" + serverName + "(" + jvmAttribute.name + ")=" + jvmAttribute.value) jvmAttributes.append([jvmAttribute.name, jvmAttribute.value]) jvmID = getJvmID(nodeName, serverName) modifyJvmAttrs(jvmID, jvmAttributes) configSave() ################## SYNC NODES (DISTRIBUTE APPS) #################### log(MAJOR_, "installOrUpdate: syncRippleStart of affected nodes ...") syncRippleStart(action, applicationModels) log(MAJOR_, "installOrUpdate: syncRippleStart of affected nodes DONE.") ################## START INSTALLED APPLICATIONS #################### if action == "install": for item in Globals.appsNodesServers: applicationModel = item[0] StartApplicationOnNodesAndServers(applicationModel, item[1]) #endFor #endIf ############### RESTORE AFFECTED NODES #################### #if ((action == "update")): # log(DEBUG_, "installOrUpdate: nodesAutosyncs="+`Globals.nodesAutosyncs`) # restoreAutosync(action, Globals.nodesAutosyncs) #endIf configSave() ################## TEST: Skipped for now, only on confirm ## testApplication(applicationModels) highlight(MAJOR_, "installOrUpdate: DONE.")
def installOrUpdate(action, distDir, wasRoot): log(VERBOSE_, "installOrUpdate: " + action + " " + distDir) log(VERBOSE_, "installOrUpdate: " + wasRoot + " ...") applicationModels = getApplications(distDir) ################## PRE-VALIDATE Application TARGETS+SETTINGS files #################### if action == "install": PreValidateApplicationsAbsent(applicationModels) else: PreValidateApplicationsExist(applicationModels) #endElse ############### CALCULATE AFFECTED NODES #################### calculateAffectedNodes(action, wasRoot, applicationModels) ################## PRE-VALIDATE NODES and SERVERS #################### PreValidateNodesAndServers(Globals.uniqueNodesContainedServers) ############### PREPARE AFFECTED NODES #################### #if ((action == "update")): # Globals.nodesAutosyncs = saveAndDisableAutosync(action, Globals.uniqueNodesContainedServers) # log(INFO_, "installOrUpdate: RESULT: nodesAutosyncs="+`Globals.nodesAutosyncs`) #endIf ############### INSTALL APPLICATION AND CONFIGURE #################### applicationModels = installAndConfigureApps(action, distDir, wasRoot, applicationModels) calculateAffectedNodes(action, wasRoot, applicationModels) for item in Globals.appsNodesServers: for nodeServer in item[1]: nodeName = nodeServer.nodeName serverName = nodeServer.serverName if len(nodeServer.jvmAttributes) > 0: jvmAttributes = [] for jvmAttribute in nodeServer.jvmAttributes: log( INFO_, "jvmAttribute " + nodeName + ":" + serverName + "(" + jvmAttribute.name + ")=" + jvmAttribute.value) jvmAttributes.append( [jvmAttribute.name, jvmAttribute.value]) jvmID = getJvmID(nodeName, serverName) modifyJvmAttrs(jvmID, jvmAttributes) configSave() ################## SYNC NODES (DISTRIBUTE APPS) #################### log(MAJOR_, "installOrUpdate: syncRippleStart of affected nodes ...") syncRippleStart(action, applicationModels) log(MAJOR_, "installOrUpdate: syncRippleStart of affected nodes DONE.") ################## START INSTALLED APPLICATIONS #################### if action == "install": for item in Globals.appsNodesServers: applicationModel = item[0] StartApplicationOnNodesAndServers(applicationModel, item[1]) #endFor #endIf ############### RESTORE AFFECTED NODES #################### #if ((action == "update")): # log(DEBUG_, "installOrUpdate: nodesAutosyncs="+`Globals.nodesAutosyncs`) # restoreAutosync(action, Globals.nodesAutosyncs) #endIf configSave() ################## TEST: Skipped for now, only on confirm ## testApplication(applicationModels) highlight(MAJOR_, "installOrUpdate: DONE.")