def register(deps): global deployments deployments = deps CommandRegistry.getRegistry().registerInstruction( re.compile(r'salt macro (?P<target>.+?)$'), do_macro, help=["salt macro <macro name> - Perform specified salt macro."])
def register(deps): global deployments deployments = deps CommandRegistry.getRegistry().registerInstruction( re.compile(r'salt macro (?P<target>.+?)$'), do_macro, help=["salt macro <macro name> - Perform specified salt macro."] )
def register(deps): global deployments deployments = deps CommandRegistry.getRegistry().registerInstruction( re.compile(r'deploy (?P<project>.+?) (?:to)? ?(?P<target>.+)$'), do_deploy, help=["deploy <project name> [to] <target> - Perform specified deployment."] )
def relay(target): registry = CommandRegistry.getRegistry() def inner_relay(msg): message = domish.Element((None, 'message')) message['to'] = target message.addElement('body', content=msg.strip()) registry.jabber.send(message) return inner_relay
def buildProtocol(self, addr): p = IrcBot() p.factory = self p.reg = CommandRegistry.getRegistry() p.nickname = self.name p.password = self.pword p.sock = self.sock return p
def authd(xmlstream): print "authenticated" reg = CommandRegistry.getRegistry() reg.registerJabber(xmlstream) presence = domish.Element(('jabber:client','presence')) xmlstream.send(presence) xmlstream.addObserver('/message', instruction_parser, registry=reg) xmlstream.addObserver('/message', debug) xmlstream.addObserver('/presence', debug) xmlstream.addObserver('/iq', debug)
def register(): CommandRegistry.getRegistry().registerInstruction(re.compile(r'(go away|shutdown)!?'), going_away)
import tornado.ioloop import tornado.web import tornado.platform.twisted tornado.platform.twisted.install() from twisted.internet import reactor from internals.commandRegistry import CommandRegistry from connectors import irc, jabber from commands import shutdown, deploy if __name__ == "__main__": import config reg = CommandRegistry.getRegistry() if reg.websinks: application = tornado.web.Application(reg.websinks) p = getattr(config, 'webport', 8808) application.listen(p) try: print "Starting loop" tornado.ioloop.IOLoop.instance().start() except: print "Stopping loop ... shutdown" reactor.fireSystemEvent('shutdown') print "Disconnect all" reactor.disconnectAll() print "Actual stop" tornado.ioloop.IOLoop.instance().stop() print "Stopped"