Exemplo n.º 1
0
    def __init__(self, env, **kwargs):
        """
        Constructor.

        Parameters
        ----------
        env: Environment
            The environment this pool is using.

        Keyworded parameters
        --------------------
        size: integer
            Size of the pool, i.e. the number of servers.
            Default: 10.
        capacity: integer
            Capacity of each server.
            Default: 10.
        kind: string
            Kind of servers in this pool.
            Default: 'regular'.
        """
        # set the default arguments
        size = kwargs['size'] if 'size' in kwargs else 10
        capacity = kwargs['capacity'] if 'capacity' in kwargs else 10
        kind = kwargs['kind'] if 'kind' in kwargs else 'regular'

        # construct a new pool
        self._pool = [
            Server(env, capacity, uuid=uuid4(), kind=kind) for _ in range(size)
        ]

        # assign some parameters as properties
        self._kind = kind

        # disabled state of this pool
        self._disabled = False

        # random state of this pool
        self._random = False

        # stuck loadbalancing state of this pool
        self._stuck = False
        self.stuckserver = None
        parser.print_help()
        sys.exit(1)

    outputDirectory = options.outputDirectory
    headers = "Server Name|User Name|Gecos|Locked|Groups|Sudo Rights"

    appServersList = parseCSV(options.serversListFile)
    for appName, serversList in appServersList.iteritems():
        if options.verbose:
            printTitle("Working on application {0}".format(appName), True)

        with open(os.path.join(outputDirectory, "{0}.psv".format(appName)),
                  'w') as f:
            f.write(headers + os.linesep)

            for serverName in serversList:
                if options.verbose:
                    printTitle("Parsing server {0}".format(serverName))
                    print headers

                server = Server(serverName)
                users = server.getUsers()
                for user in users:
                    row = "{0}|{1}|{2}|{3}|{4}|{5}".format(
                        server.getName(), user.name, user.gecos, user.isLocked,
                        " ".join(user.groups),
                        ";".join(str(v).strip() for v in user.sudoPerms))
                    if options.verbose:
                        print row
                    f.write(row + os.linesep)
	headers = "Server Name|User Name|Gecos|Locked|Groups|Sudo Rights"

	appServersList = parseCSV(options.serversListFile)
	for appName,serversList in appServersList.iteritems():
		if options.verbose:
			printTitle("Working on application {0}".format(appName), True)

		with open(os.path.join(outputDirectory, "{0}.psv".format(appName)), 'w') as f:
			f.write(headers+ os.linesep)

			for serverName in serversList:
				if options.verbose:
					printTitle("Parsing server {0}".format(serverName))
					print headers

				server = Server(serverName)
				users = server.getUsers()
				for user in users:
					row = "{0}|{1}|{2}|{3}|{4}|{5}".format(
							server.getName(),
							user.name,
							user.gecos,
							user.isLocked,
							" ".join(user.groups),
							";".join(str(v).strip() for v in user.sudoPerms)
							)
					if options.verbose:
						print row
					f.write(row + os.linesep)

Exemplo n.º 4
0
import sys
from lib.Server import Server
# from lib.ServerManager import ServerManager

gameServer = Server('127.0.0.1', 3001)
gameServer.start()

# gameServer = ServerManager('127.0.0.1', 3001)
# gameServer.start()
Exemplo n.º 5
0
 def test_server_getname(self):
     server = Server('aws-devbox-root')
     self.assertEqual(server.getName(), 'aws-devbox-root')
Exemplo n.º 6
0
 def test_server_getOSType(self):
     server = Server('aws-devbox-root')
     self.assertEqual(server.getOSType(), 'linux')
Exemplo n.º 7
0
def main():
    s = Server(3030)
    s.on_connection(lambda socket: socket.on(
        "test", lambda data: socket.to("Luka").emit("test", "Daa")))
    s.listen()
Exemplo n.º 8
0
import threading
from threading import Thread

import lib.Ngrok
from lib import bottle
from lib.MicrophoneStream import MicrophoneStream
from lib.Server import Server
myapp = Server()
bgm_thread = threading.Thread(target=myapp.play_bgm)
ngrok = lib.Ngrok.Ngrok()
threading.Thread(target=myapp.stream_speach).start()
bottle.route("/messenger", method=['POST'])(myapp.messengerFromFirebase)
bottle.route("/appNotification", method=['POST'])(myapp.app_notification)
bottle.run(host='localhost', port=9000)
#time.sleep(10)

Exemplo n.º 9
0
from lib.Server import Server


if __name__ == '__main__':
    server = Server()
    server.create_server('0.0.0.0', 4455)