def build(name, server, channel, usermap = {}, port=6667, ssl=False, pword="", s=None, zmq_endpoint='tcp://127.0.0.1:5140'): if not s: s = sock('irc_'+server, zmq_endpoint) s.twisted_register(reactor) f = IrcBotFactory(s, name, channel, usermap, pword) reactor.connectTCP(server, port, f) return f
def build(name, server, channel, usermap={}, port=6667, ssl=False, pword="", s=None, zmq_endpoint='tcp://127.0.0.1:5140'): if not s: s = sock('irc_' + server, zmq_endpoint) s.twisted_register(reactor) f = IrcBotFactory(s, name, channel, usermap, pword) reactor.connectTCP(server, port, f) return f
import sys, json, traceback from utils import sock zmq_sock = sock() import config from salt.client import LocalClient def formatter_raw(result): ans = [] for h,a in result.items(): ans.append("{} responded with {}".format(h,repr(a))) return '\n'.join(ans) #{ # 'git_|-git@blahblah_|-git@blahblah_|-latest': { # 'comment': 'Repository /blahblah/ is up-to-date', 'name': 'git@blahblah', 'start_time': '02:17:43.048571', # 'result': True, 'duration': 3455.455, '__run_num__': 3, 'changes': {}, '__id__': 'git@blahblah'}, # .... #} def formatter_state(result): ans = [] for h,a in result.items(): state_lines = [] for s, a2 in a.items(): sp = s.split('_|-') a2['PF'] = 'P' if a2['result'] else 'F' a2['short'] = "%s.%s"%(sp[0], sp[-1]) a2['duration'] = int(a2['duration'])
from __future__ import print_function, unicode_literals from utils import sock s = sock() import config my_config = { 'zmq_endpoint': getattr(config, 'zmq_endpoint', 'tcp://127.0.0.1:5140'), 'node_name': 'plumbing' } try: my_config.update(config.plumbing_options) except: print("Using default options") config.plumbing() s.connect(my_config['node_name'], my_config['zmq_endpoint']) s.foreground()