Example #1
0
        # List of servers that had problems
        problemMembers = []

        for member in memberList:
          try:
            # The cluster manager returns member information in the form
            # host,userdir,servername.  Parse out those three parts.
            serverInfo = member.split(",")
            if (len(serverInfo) != 3):
              # If the cluster manager returned badly formed data, just skip
              # the bad member and continue.
              print "The cluster manager MBean returned an incorrectly formatted member name: " + str(member)
            else:
              # Get a new connection to the MBean server for this member.
              serverConnection = connector.getMBeanServerConnection()
              serverConfig = server.config(mconnection, serverInfo[0],
                                           serverInfo[1], serverInfo[2])

              # Push the application file out
              print "Pushing the application to server " + member
              serverConfig.pushApp(appPath)
          except java.lang.Throwable, t:
            print "An exception was caught while processing member " + member
            if (arguments.DEBUG not in argParser):
              print t.toString()
            else:
              t.printStackTrace()
            problemMembers.append(member)
          except Exception, e:
            print "A python exception was caught while processing member " + member
            if (arguments.DEBUG not in argParser):
              print str(e)
    argParser = UpdateServerConfigArgs()
    if (argParser.parse(sys.argv) == True):
        try:
            JMXRESTConnector.trustStore = argParser[arguments.TRUST_STORE]
            JMXRESTConnector.trustStorePassword = argParser[
                arguments.TRUST_STORE_PASSWORD]

            connector = JMXRESTConnector()
            connector.connect(argParser[arguments.HOSTNAME],
                              int(argParser[arguments.PORT]),
                              argParser[arguments.USERNAME],
                              argParser[arguments.PASSWORD])
            mconnection = connector.getMBeanServerConnection()

            serverConfig = server.config(mconnection, argParser[SERVER_HOST],
                                         argParser[SERVER_USRDIR],
                                         argParser[SERVER_NAME])

            if (LOCAL_DIR in argParser):
                configPath = argParser[LOCAL_DIR]
            else:
                configPath = os.getcwd()

            if (argParser.getPositional(0) == "get"):
                serverConfig.get(configPath)
            else:
                serverConfig.put(configPath)

        except java.lang.Throwable, t:
            print "An exception was caught while processing the updateServerConfig command"
            if (arguments.DEBUG not in argParser):
Example #3
0
                for member in memberList:
                    try:
                        # The cluster manager returns member information in the form
                        # host,userdir,servername.  Parse out those three parts.
                        serverInfo = member.split(",")
                        if (len(serverInfo) != 3):
                            # If the cluster manager returned badly formed data, just skip
                            # the bad member and continue.
                            print "The cluster manager MBean returned an incorrectly formatted member name: " + str(
                                member)
                        else:
                            # Get a new connection to the MBean server for this member.
                            serverConnection = connector.getMBeanServerConnection(
                            )
                            serverConfig = server.config(
                                mconnection, serverInfo[0], serverInfo[1],
                                serverInfo[2])

                            # Push the configuration file out
                            print "Pushing the server.xml to server " + member
                            serverConfig.pushConfig(configPath)
                    except java.lang.Throwable, t:
                        print "An exception was caught while processing member " + member
                        if (arguments.DEBUG not in argParser):
                            print t.toString()
                        else:
                            t.printStackTrace()
                        problemMembers.append(member)
                    except Exception, e:
                        print "A python exception was caught while processing member " + member
                        if (arguments.DEBUG not in argParser):
Example #4
0
                        # The cluster manager returns member information in the form
                        # host,userdir,servername.  Parse out those three parts.
                        serverInfo = member.split(",")
                        if (len(serverInfo) != 3):
                            # If the cluster manager returned badly formed data, just skip
                            # the bad member and continue.
                            print "The cluster manager MBean returned an incorrectly formatted member name: " + str(
                                member)
                        else:
                            host = str(serverInfo[0])
                            userDir = str(serverInfo[1])
                            serverName = str(serverInfo[2])
                            # Get a new connection to the MBean server for this member.
                            serverConnection = connector.getMBeanServerConnection(
                            )
                            serverConfig = server.config(
                                mconnection, host, userDir, serverName)

                            # Create a directory for the member server's configuration.
                            pathToServerConfig = configPath + os.sep + "manageAppOnCluster_tmp" + os.sep + serverName

                            if (os.path.exists(pathToServerConfig) == False):
                                os.makedirs(pathToServerConfig)

                            serverConfig.get(pathToServerConfig)
                            f = open(
                                pathToServerConfig + os.sep + "server.xml",
                                'r')
                            configLines = []

                            if (INSTALL in argParser):
                                print "Uploading application " + str(