Exemplo n.º 1
0
def configureMachine(machineName, listenAddress, listenPort):
    print 'creating machine ' + machineName
    cmo = cd('/')
    machine = create(machineName, 'UnixMachine')
    cmo = cd('Machines/' + machineName)
    create(machineName, 'NodeManager')
    cmo = cd('NodeManager/' + machineName)
    set('ListenAddress', listenAddress)
    set('ListenPort', int(listenPort))
    set('NMType', 'Plain')
    return machine
Exemplo n.º 2
0
def populateClusterOffline(clusterName) :
    serverName = props.get("managed.server.1.name")
    LOGGER.info("Adding " + str(serverName) + " to cluster " + str(clusterName))
    cmo = cd('/')
    result = assign("server", serverName, "Cluster", clusterName)
    LOGGER.info("result = " + str(result))
    LOGGER.info("Added " + str(serverName) + " to cluster " + str(clusterName))
Exemplo n.º 3
0
def populateClusterOnline(clusterName) :
    serverName = props.get("managed.server.1.name")
    LOGGER.info("Adding " + str(serverName) + " to cluster " + str(clusterName))
    cmo = cd('/Servers/' + str(serverName))
    cluster = getMBean('/Clusters/' + str(clusterName))
    result = setCluster(cluster)
    LOGGER.info("the result = " + str(result))
    LOGGER.info("populateClusterOnline complete. " + str(serverName) + " to cluster " + str(clusterName))
Exemplo n.º 4
0
def rePointAppTargets(userName, password, url, properties):
    if connectToAdminServer(userName, password, url):
        try:
            edit()
            startEdit()

            cmo = cd('AppDeployments')
            i = 1
            source = properties.get("migrate.target." + str(i) + ".source")
            while source:
                destination = properties.get("migrate.target." + str(i) +
                                             ".destination")
                destinationType = properties.get("migrate.target." + str(i) +
                                                 ".type")
                deployments = ls(returnMap='true')

                for deployment in deployments:
                    print deployment
                    pushd(deployment + "/Targets")
                    targets = ls(returnMap='true')
                    newTargets = []
                    rePoint = False

                    for target in targets:
                        print("Target='" + target + "'")
                        theTarget = target
                        if target == source:
                            theTarget = destination
                            type = destinationType
                            rePoint = True
                        else:
                            # find the type:
                            pushd(target)
                            type = get("Type")
                        newTargets.append(
                            ObjectName("com.bea:Name=" + theTarget + ",Type=" +
                                       type))

                    print("New Targets: " +
                          str(jarray.array(newTargets, ObjectName)))
                    if rePoint:
                        print("Repointing targets: " +
                              str(jarray.array(newTargets, ObjectName)))
                        set('Targets', jarray.array(newTargets, ObjectName))
                    popd()

                i = i + 1
                source = properties.get("migrate.target." + str(i) + ".source")

            save()
            activate()
        except Exception, e:
            LOGGER.severe("Caught Exception in migration : " + e)
            cancelEdit("y")
            raise e
Exemplo n.º 5
0
def verifyDeployment(self, appDeployment):
    try:
        domainConfig()
        cmo = cd('/AppDeployments/' + appDeployment.getName() + '/Targets')
        targets = lsmap()
        domainRuntime()
        cmo = cd('AppRuntimeStateRuntime')
        cmo = cd('AppRuntimeStateRuntime')
        for target in targets:
            state = getCurrentState(appDeployment.getName(), target)
            if state != "STATE_ACTIVE":
                self.assert_(
                    False, "State of Deployment not ACTIVE: " +
                    appDeployment.getName() + ", state=" + state)
                if state == "STATE_NEW":
                    LOGGER.info("Ensure managed servers are started")

    except WLSTException:
        self.assert_(
            False,
            "Unable to get state of Deployment: " + appDeployment.getName())
Exemplo n.º 6
0
def configureMachines(props, domain):
    # 'Hardwire' name of admin machine: ultimately should be a domain property
    print 'configuring admin server'
    adminMachineName = 'AdminMachine'
    print "Configuring admin server with machine=" + str(
        adminMachineName) + ", listen address=" + str(
            props.get('listenAddress')) + ", listen port=" + str(
                props.get('wls.NODEMGR_PORT'))
    adminMachine = configureMachine(adminMachineName,
                                    props.get('listenAddress'),
                                    props.get('wls.NODEMGR_PORT'))
    assignServer('AdminServer', adminMachineName)

    print 'configuring managed servers'

    i = 1
    prefix = "managed.server."
    ms_name = props.get(prefix + str(i) + ".name")
    while (ms_name):
        ms_host = props.get(prefix + str(i) + '.listenAddress')
        ms_port = props.get(prefix + str(i) + '.listenPort')
        print 'configuring server ' + ms_name
        if ms_host is None:
            print 'Host name for managed server ' + ms_name + ' missing from property file'
            return False
        if ms_port is None:
            print 'Port number for managed server ' + ms_name + ' missing from property file'
            return False

        print "Configuring " + ms_name + " with machine=" + str(
            adminMachineName) + ", listen address=" + str(
                ms_host) + ", listen port=" + str(ms_port)
        cmo = cd('/Servers/' + ms_name)
        set('ListenAddress', ms_host)
        set('ListenPort', int(ms_port))
        # For now, assign all servers to admin machine
        set('Machine', adminMachine)
        i = i + 1
        ms_name = props.get(prefix + str(i) + '.name')

    print 'configured ' + str(i - 1) + ' managed servers'
    return True
Exemplo n.º 7
0
def enabledAdminPort(adminPortEnabled, AdminPort, listenPort):
    cmo = cd('/')
    set('AdministrationPortEnabled', adminPortEnabled)
    set('AdministratorPort', int(listenPort))
    return
Exemplo n.º 8
0
def assignServer(serverName, machineName):
    print 'assigning ' + serverName + ' to machineName'
    machine = cmo = cd('/Machines/' + machineName)
    cmo = cd('/Servers/' + serverName)
    set('Machine', machine)
Exemplo n.º 9
0
    print "Missing \"-t domainDir\" parameter."
    usage()
    sys.exit(2)

if properties == "":
    print "Missing \"-p Property File\" parameter."
    usage()
    sys.exit(2)

propsInputStream = FileInputStream(properties)
props.load(propsInputStream)

print "Shutting down domain" + domainDir
try:
	connect(props.get('adminUserName'), props.get('adminPassword'), 't3://' + props.get('listenAddress') + ':' + props.get('listenPort'))
	cmo = cd('/')
	adminServerName = cmo.getAdminServerName()
	cmo = cd('/Servers')
	servers = cmo.getServers()
	# Shut down all managed servers first
	for server in servers:
		if (server.getName() != adminServerName):
			try:
				shutdown(server.getName(), block='true')
			except:
				print 'Unable to shutdown server ' + server.getName()

	# Now shutdown admin server
	shutdown(block='false')
	disconnect()
	print "Shutdown completed"
Exemplo n.º 10
0
 def test_Deployments(self):
     cmo = cd('/AppDeployments')
     appDeployments = getAppDeployments()
     for appDeployment in appDeployments:
         verifyDeployment(self, appDeployment)