def get_info(self): ''' Returns information about active request processor. @return: DynamicObject ''' processor = self.get_processor() info = DynamicObject(mode=processor.get_name()) info.update(processor.get_params()) return info
def register(self, channel_id, certificate, **options): ''' Registers a new channel. @param channel_id: channel ID @param certificate: certificate content @param **options: description: channel description enabled: channel enable flag ''' message = 'Trying to register channel [{0}]' ChannelManager.LOGGER.debug(message.format(channel_id)) # Checking channel existence if self.is_registered(channel_id): message = _('Channel {0} is already registered.') raise ChannelManagerException(message.format(channel_id)) # Checking the previous channel with the same certificate registered_channel = \ self.try_get_by_certificate(certificate) if registered_channel is not None: message = _('Certificate is in use.') raise ChannelManagerException(message) # Deciding on important parameters options['description'] = options.get('description') options['enabled'] = options.get('enabled') if options['enabled'] is None: options['enabled'] = True options['certificate_required'] = options.get('certificate_required') if options['certificate_required'] is None: options['certificate_required'] = True # Setting allowed and denied commands options['allowed'] = options.get('allowed') options['denied'] = options.get('denied') # Creating channel information channel = DynamicObject(id=channel_id, certificate=certificate) channel.update(options) # Registering channel self._channels[channel_id] = channel message = 'Channel [{0}] successfully registered' ChannelManager.LOGGER.info(message.format(channel_id))