def confirm(action, distDir, wasRoot): log(VERBOSE_, "confirm: " + action + " " + distDir) log(VERBOSE_, "confirm: " + wasRoot + " ...") ############### FIND APPLICATIONS #################### applicationModels = getApplications(distDir, "*.xml.done") applicationModels.extend(getApplications(distDir, "*.xml.confirmed")) for applicationModel in applicationModels: log(INFO_, "confirm: Deployment applicationModel=" + `applicationModel.name`) ################## PRE-VALIDATE APPLICATIONS (exists) #################### PreValidateApplicationsExist(applicationModels) ############### CALCULATE AFFECTED NODES #################### calculateAffectedNodes(action, wasRoot, applicationModels) ################## PRE-VALIDATE NODES and SERVERS #################### PreValidateNodesAndServers(Globals.uniqueNodesContainedServers) ################## TEST #################### testApplication(applicationModels) nodeSyncStatus = {} for nodeContainedServers in Globals.uniqueNodesContainedServers: node = nodeContainedServers[0] if not node in nodeSyncStatus.keys(): nodeSync = WebSphere.AdminControl.completeObjectName("type=NodeSync,node=%s,*" % node) nodeSyncStatus[node] = WebSphere.AdminControl.invoke(nodeSync, "isNodeSynchronized") print "NODE SYNC STATUS: %s" % nodeSyncStatus highlight(MAJOR_, "confirm: DONE.")
def confirm(action, distDir, wasRoot): log(VERBOSE_, "confirm: " + action + " " + distDir) log(VERBOSE_, "confirm: " + wasRoot + " ...") ############### FIND APPLICATIONS #################### applicationModels = getApplications(distDir, "*.xml.done") applicationModels.extend(getApplications(distDir, "*.xml.confirmed")) for applicationModel in applicationModels: log( INFO_, "confirm: Deployment applicationModel=" + ` applicationModel.name `) ################## PRE-VALIDATE APPLICATIONS (exists) #################### PreValidateApplicationsExist(applicationModels) ############### CALCULATE AFFECTED NODES #################### calculateAffectedNodes(action, wasRoot, applicationModels) ################## PRE-VALIDATE NODES and SERVERS #################### PreValidateNodesAndServers(Globals.uniqueNodesContainedServers) ################## TEST #################### testApplication(applicationModels) nodeSyncStatus = {} for nodeContainedServers in Globals.uniqueNodesContainedServers: node = nodeContainedServers[0] if not node in nodeSyncStatus.keys(): nodeSync = WebSphere.AdminControl.completeObjectName( "type=NodeSync,node=%s,*" % node) nodeSyncStatus[node] = WebSphere.AdminControl.invoke( nodeSync, "isNodeSynchronized") print "NODE SYNC STATUS: %s" % nodeSyncStatus highlight(MAJOR_, "confirm: 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.")
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.")