def __init__(self, hostname, port, home_dir, node_name='anonymous_node', ks_path=None, ks_passwd=None, node_type=None, bind_host='0.0.0.0', config={}): self.hostname = hostname self.bind_host = bind_host self.port = port self.home_dir = home_dir self.node_name = node_name self.node_type = node_type self.config = config self.__auth_key = hashlib.sha1(str(uuid.uuid4())).hexdigest() config_file = os.path.join(home_dir, CONFIG_FILE_NAME) Config.load(config_file) self.config.update(Config.get_config_dict()) if ks_path: self.keystore = init_keystore(ks_path, ks_passwd) ca_files = self.keystore.autodetect_ca(home_dir) if ca_files: logger.info('CA certificates detected at: %s'%(' '.join(ca_files),)) else: logger.warning('No one CA certificate autodetected') else: self.keystore = None self.server = None self.operator_process = None self.osproc_stat = None cur_thread = threading.current_thread() cur_thread.setName('%s-main'%self.node_name) self.operators_map = {'base': Operator} self.operators_map.update( PluginsManager.get_operators() )
def get_config(self): return Config.get_config_dict()