def syncRippleStart(action, applicationModels):
    for nodeContainedServers in Globals.uniqueNodesContainedServers:
        nodeName = nodeContainedServers[0]
        syncNDNode(nodeName)
        log(MAJOR_, "syncRippleStart synced: " + nodeName)
    for applicationModel in applicationModels:
        execScript(applicationModel, "afterSync")
    for clusterName in Globals.clusters.keys():
        cluster = WebSphere.AdminControl.completeObjectName('type=Cluster,name=%s,*' % clusterName)
        clusterTarget = Globals.clusters[clusterName]
        if not len(clusterTarget.inactiveServers):
            WebSphere.AdminControl.invoke(cluster, 'rippleStart')
            log(MAJOR_, "syncRippleStart: rippleStart " + clusterName + " invoked")
            sleepDelay(3)
    for nodeServerPair in Globals.unclusteredNodeServerPairs:
        stopNDServer(nodeServerPair[0], nodeServerPair[1])
        startNDServer(nodeServerPair[0], nodeServerPair[1])
    checkClustersStarted(Globals.clusters)
    for applicationModel in applicationModels:
        execScript(applicationModel, "afterRippleStart")
Exemple #2
0
def syncRippleStart(action, applicationModels):
    for nodeContainedServers in Globals.uniqueNodesContainedServers:
        nodeName = nodeContainedServers[0]
        syncNDNode(nodeName)
        log(MAJOR_, "syncRippleStart synced: " + nodeName)
    for applicationModel in applicationModels:
        execScript(applicationModel, "afterSync")
    for clusterName in Globals.clusters.keys():
        cluster = WebSphere.AdminControl.completeObjectName(
            'type=Cluster,name=%s,*' % clusterName)
        clusterTarget = Globals.clusters[clusterName]
        if not len(clusterTarget.inactiveServers):
            WebSphere.AdminControl.invoke(cluster, 'rippleStart')
            log(MAJOR_,
                "syncRippleStart: rippleStart " + clusterName + " invoked")
            sleepDelay(3)
    for nodeServerPair in Globals.unclusteredNodeServerPairs:
        stopNDServer(nodeServerPair[0], nodeServerPair[1])
        startNDServer(nodeServerPair[0], nodeServerPair[1])
    checkClustersStarted(Globals.clusters)
    for applicationModel in applicationModels:
        execScript(applicationModel, "afterRippleStart")
def installAndConfigureApps( action, distDir, wasRoot, applicationModels ):
    log(INFO_, "")
    log(MAJOR_, "installAndConfigureApps: applicationModels=" + `applicationModels` + " ...")

    listApplications()
    result = []

    ################ INSTALL (or UPDATE) AND CONFIGURE ##############
    for applicationModel in applicationModels:
        try:
            if applicationModel.file.startswith("/"):
                appPath = applicationModel.file
            else:
                appPath = distDir + "/" + applicationModel.file
            if not validateEAR(appPath):
                continue

            ################ READ APP INSTALL OPTIONS (from .settings) ##############
            installOptions = ""
            for installOption in applicationModel.installOptions:
                installOptions = installOptions + " " + installOption
                ################ INSTALL ##############
            nodeName = ""
            serverName = ""
            if len(applicationModel.servers) > 0:
                appNodeServerPair = applicationModel.servers[0]
                nodeName = appNodeServerPair.nodeName
                serverName = appNodeServerPair.serverName
                #endIf
            clusterName = ""
            if len(applicationModel.clusters) > 0:
                clusterName = applicationModel.clusters[0].clusterName
                #endIf
            if action == "install":
                appExists = checkIfAppExists(applicationModel)
                if appExists:
                    msg = "application=" + applicationModel.name + " EXISTS, CANNOT install with same name"
                    fail(msg)
                    highlight(ERROR_,
                        "application=" + applicationModel.name + " EXISTS, will process SETTINGS and TARGETS")
                else:
                    installEAR(action, appPath, applicationModel, clusterName, nodeName, serverName, installOptions)
                    #endElse
            elif action == "update":
                appExists = checkIfAppExists(applicationModel)
                if appExists:
                    installEAR(action, appPath, applicationModel, clusterName, nodeName, serverName, installOptions)
                else:
                    msg = "application=" + applicationModel.name + " DOES NOT EXIST, will INSTALL instead of UPDATE"
                    log(WARNING_, msg)
                    installEAR("install", appPath, applicationModel, clusterName, nodeName, serverName, installOptions)
                    #endElse
                #endIf

            ################ CONFIG SETTINGS ##############
            applySettings(applicationModel)

            ################ VALIDATE INSTALLED APPLICATION ##############
            validateApplication(applicationModel)
        except AdminException, e:
            log(WARNING_, "AdminException=" + e.message)
            WebSphere.AdminConfig.reset()

        else:
            configSave()
            syslog("info", "successful %s:%s:%s:%s" % (
            action, applicationModel.serviceCall, applicationModel.name, applicationModel.version))
            execScript(applicationModel, "afterInstall")
            os.rename(applicationModel.configFile, applicationModel.configFile + '.done')
            applicationModel.configFile = applicationModel.configFile + '.done'
            result.append(applicationModel)
def installAndConfigureApps(action, distDir, wasRoot, applicationModels):
    log(INFO_, "")
    log(
        MAJOR_, "installAndConfigureApps: applicationModels=" +
        ` applicationModels ` + " ...")

    listApplications()
    result = []

    ################ INSTALL (or UPDATE) AND CONFIGURE ##############
    for applicationModel in applicationModels:
        try:
            if applicationModel.file.startswith("/"):
                appPath = applicationModel.file
            else:
                appPath = distDir + "/" + applicationModel.file
            if not validateEAR(appPath):
                continue

            ################ READ APP INSTALL OPTIONS (from .settings) ##############
            installOptions = ""
            for installOption in applicationModel.installOptions:
                installOptions = installOptions + " " + installOption
                ################ INSTALL ##############
            nodeName = ""
            serverName = ""
            if len(applicationModel.servers) > 0:
                appNodeServerPair = applicationModel.servers[0]
                nodeName = appNodeServerPair.nodeName
                serverName = appNodeServerPair.serverName
                #endIf
            clusterName = ""
            if len(applicationModel.clusters) > 0:
                clusterName = applicationModel.clusters[0].clusterName
                #endIf
            if action == "install":
                appExists = checkIfAppExists(applicationModel)
                if appExists:
                    msg = "application=" + applicationModel.name + " EXISTS, CANNOT install with same name"
                    fail(msg)
                    highlight(
                        ERROR_, "application=" + applicationModel.name +
                        " EXISTS, will process SETTINGS and TARGETS")
                else:
                    installEAR(action, appPath, applicationModel, clusterName,
                               nodeName, serverName, installOptions)
                    #endElse
            elif action == "update":
                appExists = checkIfAppExists(applicationModel)
                if appExists:
                    installEAR(action, appPath, applicationModel, clusterName,
                               nodeName, serverName, installOptions)
                else:
                    msg = "application=" + applicationModel.name + " DOES NOT EXIST, will INSTALL instead of UPDATE"
                    log(WARNING_, msg)
                    installEAR("install", appPath, applicationModel,
                               clusterName, nodeName, serverName,
                               installOptions)
                    #endElse
                #endIf

            ################ CONFIG SETTINGS ##############
            applySettings(applicationModel)

            ################ VALIDATE INSTALLED APPLICATION ##############
            validateApplication(applicationModel)
        except AdminException, e:
            log(WARNING_, "AdminException=" + e.message)
            WebSphere.AdminConfig.reset()

        else:
            configSave()
            syslog(
                "info", "successful %s:%s:%s:%s" %
                (action, applicationModel.serviceCall, applicationModel.name,
                 applicationModel.version))
            execScript(applicationModel, "afterInstall")
            os.rename(applicationModel.configFile,
                      applicationModel.configFile + '.done')
            applicationModel.configFile = applicationModel.configFile + '.done'
            result.append(applicationModel)