Ejemplo n.º 1
0
def deleteProject(alsbConfigurationMBean, projectName):
    try:
        projectRef = Ref(Ref.PROJECT_REF, Ref.DOMAIN, projectName)
        if alsbConfigurationMBean.exists(projectRef):
            print 'INFO: Removing OSB project: ' + projectName
            alsbConfigurationMBean.delete(Collections.singleton(projectRef))
            print 'INFO: Removed OSB project: ' + projectName
        else:
            raise ValueError('No OSB project exists with name ' + projectName)
    except:
        raise
Ejemplo n.º 2
0
def deleteOSBProject(alsbConfigurationMBean, projectName):
    '''Delete a OSB project'''
    try:
        msg("Trying to remove " + projectName, _LOG_LEVEL.INFO)
        projectRef = Ref(Ref.PROJECT_REF, Ref.DOMAIN, projectName)
        if alsbConfigurationMBean.exists(projectRef):
            msg("#### removing OSB project: " + projectName, _LOG_LEVEL.INFO)
            alsbConfigurationMBean.delete(Collections.singleton(projectRef))
            msg("#### removed project: " + projectName, _LOG_LEVEL.INFO)
        else:
            msg("OSB project <" + projectName + "> does not exist",
                _LOG_LEVEL.WARNING)
    except:
        msg("Error whilst removing project:" + sys.exc_info()[0],
            _LOG_LEVEL.ERROR)
        raise
Ejemplo n.º 3
0
def undeployProject():
    SessionMBean = None

    print 'Attempting to undeploy', project, ' from ALSB Admin Server listening on ', adminUrl

    # domainRuntime()
    sessionName = "TransientWLSTSession_" + str(System.currentTimeMillis())
    sessMgmtMBean = findService(SessionManagementMBean.NAME,
                                SessionManagementMBean.TYPE)
    sessMgmtMBean.createSession(sessionName)

    print 'Created session [', sessionName, '] ... ', ALSBConfigurationMBean.NAME, "." + sessionName, ALSBConfigurationMBean.TYPE

    alsbConfigMBean = findService(
        ALSBConfigurationMBean.NAME + "." + sessionName,
        ALSBConfigurationMBean.TYPE)

    projectRefs = alsbConfigMBean.getRefs(Ref.DOMAIN)
    projectRef = Ref(Ref.PROJECT_REF, Ref.DOMAIN, project)

    if alsbConfigMBean.exists(projectRef):
        print "#### removing OSB project: " + projectRef.getProjectName()
        if projectRef.getProjectName() == "System":
            print "Omitting System project, it must not be deleted ..."
        else:
            alsbConfigMBean.delete(Collections.singleton(projectRef))
        print
    else:
        failed = "OSB project <" + projectRef.getProjectName(
        ) + "> does not exist"
        print failed
    print

    print "Activating session ... "
    sessMgmtMBean.activateSession(
        sessionName, "Complete project removal with customization using wlst")
    print "Session activated."
    cleanupSession(sessMgmtMBean, sessionName)
    print "done!"
Ejemplo n.º 4
0
                        sessionMBean = findService(SessionManagementMBean.NAME,
                                                   SessionManagementMBean.TYPE)
                        sessionMBean.createSession(sessionName)
                        mbean = findService(
                            String("ProxyServiceConfiguration.").concat(
                                sessionName),
                            'com.bea.wli.sb.management.configuration.ProxyServiceConfigurationMBean'
                        )
                        projectName = Refs.makeParentRef(project)
                        proxyRef = Refs.makeProxyRef(projectName, service)
                        #print "Disabling... " + service
                        serviceStatus = str(mbean.isEnabled(proxyRef))
                        if mbean.isEnabled(proxyRef) == 1:
                            mbean.disableService(proxyRef)
                            refArray = []
                            refArray.append(Ref(typeID, projectName, service))
                            cmo.resetStatistics(refArray)
                            #print " === Resetting statistics for this service."
                            action = "Disable/reset Data"
                        else:
                            #print "Service already disabled."
                            action = "Already disabled"
                        sessionMBean.activateSession(sessionName,
                                                     "Auto Disabled BS ")

                    strTable = []
                    strTable.append(ref.getProjectName())
                    strTable.append(service)
                    strTable.append(e.getName())
                    strTable.append(str(e.getMin()))
                    strTable.append(str(e.getMax()))
Ejemplo n.º 5
0
    if sessionMBean.sessionExists(sessionName):
        discardSession(sessionMBean, sessionName)

    sessionMBean.createSession(sessionName)

    # obtain the ALSBConfigurationMBean instance that operates
    # on the session that has just been created. Notice that
    # the name of the mbean contains the session name.
    alsbSession = findService(ALSBConfigurationMBean.NAME + "." + sessionName,
                              ALSBConfigurationMBean.TYPE)

    refs = ArrayList()

    for project in undeployProjList:
        projectRef = Ref(Ref.PROJECT_REF, Ref.DOMAIN, project.strip())
        if alsbSession.exists(projectRef):
            print "#### adding OSB project to the delete list: " + project.strip(
            )
            refs.add(projectRef)

        else:
            print "OSB project <" + project.strip() + "> does not exist"

    alsbSession.delete(refs)

    # activate changes performed in the session
    sessionMBean.activateSession(
        sessionName, "Complete project removal with customization using wlst")

    print "#### removed project: " + configProps.get('undeployProjects')