Example #1
0
 def __init__(self):
     self.logger = logging.getLogger('dscached')
     self.config = None
     self.datastore = None
     self.configstore = None
     self.rpc = RpcContext()
     self.rpc.streaming_enabled = True
     self.rpc.streaming_burst = 16
     self.client = None
     self.server = None
     self.plugin_dirs = []
     self.plugins = {}
     self.directories = []
     self.users_cache = TTLCacheStore()
     self.groups_cache = TTLCacheStore()
     self.hosts_cache = TTLCacheStore()
     self.cache_ttl = 7200
     self.search_order = []
     self.cache_enumerations = True
     self.cache_lookups = True
     self.home_directory_root = None
     self.account_service = AccountService(self)
     self.group_service = GroupService(self)
     self.rpc.register_service_instance('dscached.account',
                                        self.account_service)
     self.rpc.register_service_instance('dscached.group',
                                        self.group_service)
     self.rpc.register_service_instance('dscached.host', HostService(self))
     self.rpc.register_service_instance('dscached.idmap',
                                        IdmapService(self))
     self.rpc.register_service_instance('dscached.management',
                                        ManagementService(self))
     self.rpc.register_service_instance('dscached.debug', DebugService())
Example #2
0
    def connect(self):
        while True:
            try:
                self.client.connect('unix:')
                self.client.login_service('statd')
                self.client.enable_server()
                self.register_schemas()
                self.client.register_service('statd.output',
                                             OutputService(self))
                self.client.register_service('statd.alert', AlertService(self))
                self.client.register_service('statd.debug',
                                             DebugService(gevent=True))
                self.client.resume_service('statd.output')
                self.client.resume_service('statd.alert')
                self.client.resume_service('statd.debug')
                for i in list(self.data_sources.keys()):
                    self.client.call_sync('plugin.register_event_type',
                                          'statd.output',
                                          'statd.{0}.pulse'.format(i))

                return
            except (OSError, RpcException) as err:
                self.logger.warning(
                    'Cannot connect to dispatcher: {0}, retrying in 1 second'.
                    format(str(err)))
                time.sleep(1)
Example #3
0
 def connect(self):
     while True:
         try:
             self.client.connect('unix:')
             self.client.login_service('etcd')
             self.client.enable_server()
             self.client.register_service('etcd.generation', FileGenerationService(self))
             self.client.register_service('etcd.management', ManagementService(self))
             self.client.register_service('etcd.debug', DebugService())
             self.client.resume_service('etcd.generation')
             self.client.resume_service('etcd.management')
             self.client.resume_service('etcd.debug')
             return
         except (OSError, RpcException) as err:
             self.logger.warning('Cannot connect to dispatcher: {0}, retrying in 1 second'.format(str(err)))
             time.sleep(1)
Example #4
0
    def connect(self, resume=False):
        while True:
            try:
                self.client.connect('unix:')
                self.client.login_service('networkd')
                self.client.enable_server()
                self.register_schemas()
                self.client.register_service('networkd.configuration', ConfigurationService(self))
                self.client.register_service('networkd.debug', DebugService())
                if resume:
                    self.client.resume_service('networkd.configuration')
                    self.client.resume_service('networkd.debug')

                return
            except (OSError, RpcException) as err:
                self.logger.warning('Cannot connect to dispatcher: {0}, retrying in 1 second'.format(str(err)))
                time.sleep(1)
Example #5
0
 def connect(self):
     while True:
         try:
             self.client.connect('unix:')
             self.client.login_service('clid')
             self.client.enable_server()
             self.client.call_sync('management.enable_features', ['streaming_responses'])
             self.client.register_service('clid.management', ManagementService(self))
             self.client.register_service('clid.eval', EvalService(self))
             self.client.register_service('clid.debug', DebugService())
             self.client.resume_service('clid.management')
             self.client.resume_service('clid.eval')
             self.client.resume_service('clid.debug')
             return
         except (OSError, RpcException) as err:
             self.logger.warning('Cannot connect to dispatcher: {0}, retrying in 1 second'.format(str(err)))
             time.sleep(1)
Example #6
0
 def __init__(self):
     self.store = collections.deque()
     self.lock = threading.Lock()
     self.seqno = 0
     self.rpc_server = Server(self)
     self.boot_id = str(uuid.uuid4())
     self.exiting = False
     self.server = None
     self.servers = []
     self.klog_reader = None
     self.flush = False
     self.flush_thread = None
     self.datastore = None
     self.started_at = datetime.utcnow()
     self.rpc = RpcContext()
     self.rpc.register_service_instance('logd.logging',
                                        LoggingService(self))
     self.rpc.register_service_instance('logd.debug', DebugService())
     self.cv = threading.Condition()