示例#1
0
def main():
	(config, configFiles) = getConfig(["Agent"])
	publisher = instantiateImplementation(config.get("Agent", "publisher"), config)
	tashi.publisher = publisher
	client = createClient(config)
	logging.config.fileConfig(configFiles)
	agent = Primitive(config, client)
	#agent.conservePower()
	agent.start()
示例#2
0
 def setup(self):
     global config
     self.log = logging.getLogger(__file__)
     SocketServer.StreamRequestHandler.setup(self)
     self.ihooks = InstanceHooks(config)
     (self.client, self.transport) = createClient(config)
     self.tashiconnection = tashiconnection
     self.auth = config.get('MauiWiki', 'authuser')
     self.key = config.get('MauiWiki', 'authkey')
示例#3
0
    def __init__(self, config, client, transport):
        (self.client, self.transport) = createClient(config)

        self.hosts = {}
        self.instances = {}
        self.users = {}

        self.config = config
        self.ihooks = InstanceHooks(config)
        self.log = logging.getLogger(__file__)
        self.refreshTime = float(self.config.get('MauiWiki', 'refreshTime'))
        self.defaultJobTime = str(self.config.get('MauiWiki',
                                                  'defaultJobTime'))
        threading.Thread.__init__(self)
        self.daemon = True
示例#4
0
 def __init__(self, config):
     self.log = logging.getLogger(__file__)
     self.hooks = []
     items = config.items("MauiWiki")
     items.sort()
     for item in items:
         (name, value) = item
         name = name.lower()
         if (name.startswith("hook")):
             try:
                 self.hooks.append(
                     instantiateImplementation(value, config, client,
                                               transport, False))
             except:
                 self.log.exception("Failed to load hook %s" % (value))
     (self.client, self.transport) = createClient(config)
示例#5
0
    def __init__(self, config):
        self.config = config
        self.cm = createClient(config)
        self.hooks = []
        self.log = logging.getLogger(__file__)

        items = self.config.items("Accounting")
        items.sort()
        for item in items:
            (name, value) = item
            name = name.lower()
            if (name.startswith("hook")):
                try:
                    self.hooks.append(
                        instantiateImplementation(value, self.config, self.cm,
                                                  False))
                except:
                    self.log.exception("Failed to load hook %s" % (value))
示例#6
0
 def __init__(self):
     self.config = getConfig(["Client"])[0]
     self.client = createClient(self.config)
     self.log = logging.getLogger("TashiSSH")
示例#7
0
        elif dat[0] == 'CMD=STARTJOB':
            r = self.processStartJob(p)
        elif dat[0] == 'CMD=CANCELJOB':
            r = self.processCancelJob(p)
        else:
            print 'got unknown packet'
            print p.prettyString()
            r = MauiPacket()
            r.set(['SC=-810', 'RESPONSE=command not supported'])
        print r.prettyString()
        self.ostream.write(str(r))
        self.ostream.flush()
        self.ostream.close()
        self.ostream.close()
        self.istream.close()


if __name__ == '__main__':
    (config, configFiles) = getConfig(["Agent"])
    publisher = instantiateImplementation(config.get("Agent", "publisher"),
                                          config)
    tashi.publisher = publisher
    (client, transport) = createClient(config)
    logging.config.fileConfig(configFiles)
    tashiconnection = TashiConnection(config, client, transport)
    tashiconnection.start()

    HOST, PORT = '', 1717
    server = SocketServer.TCPServer((HOST, PORT), MauiListener)
    server.serve_forever()
示例#8
0
 def __init__(self):
     self.config = getConfig(["Client"])[0]
     self.client = createClient(self.config)
     self.log = logging.getLogger("TashiSSH")