Exemplo n.º 1
0
    def updateConfig(self, config):
        OutputPlugin.updateConfig(self, config)
        try:
            if hasattr(self.config, 'httpeventServers') is False:
                if hasattr(self._sample, 'httpeventServers'):
                    self.config.httpeventServers = self._sample.httpeventServers
                else:
                    self.logger.error(
                        'outputMode httpevent but httpeventServers not specified for sample %s'
                        % self._sample.name)
                    raise NoServers(
                        'outputMode httpevent but httpeventServers not specified for sample %s'
                        % self._sample.name)
            # set default output mode to round robin
            if hasattr(
                    self.config,
                    'httpeventOutputMode') and self.config.httpeventOutputMode:
                self.httpeventoutputmode = self.config.httpeventOutputMode
            else:
                if hasattr(self._sample, 'httpeventOutputMode'
                           ) and self._sample.httpeventOutputMode:
                    self.httpeventoutputmode = self._sample.httpeventOutputMode
                else:
                    self.httpeventoutputmode = 'roundrobin'

            if hasattr(self.config, 'httpeventMaxPayloadSize'
                       ) and self.config.httpeventMaxPayloadSize:
                self.httpeventmaxsize = self.config.httpeventMaxPayloadSize
            else:
                if hasattr(self._sample, 'httpeventMaxPayloadSize'
                           ) and self._sample.httpeventMaxPayloadSize:
                    self.httpeventmaxsize = self._sample.httpeventMaxPayloadSize
                else:
                    self.httpeventmaxsize = 10000

            if hasattr(self.config, 'httpeventAllowFailureCount'
                       ) and self.config.httpeventAllowFailureCount:
                self.httpeventAllowFailureCount = int(
                    self.config.httpeventAllowFailureCount)
            else:
                if hasattr(self._sample, 'httpeventAllowFailureCount'
                           ) and self._sample.httpeventAllowFailureCount:
                    self.httpeventAllowFailureCount = int(
                        self._sample.httpeventAllowFailureCount)
                else:
                    self.httpeventAllowFailureCount = 100

            self.logger.debug("Currentmax size: %s " % self.httpeventmaxsize)
            if isinstance(config.httpeventServers, str):
                self.httpeventServers = json.loads(config.httpeventServers)
            else:
                self.httpeventServers = config.httpeventServers
            self.logger.debug("Setting up the connection pool for %s in %s" %
                              (self._sample.name, self._app))
            self.createConnections()
            self.logger.debug(
                "Pool created and finished init of httpevent plugin.")
        except Exception as e:
            self.logger.exception(str(e))
Exemplo n.º 2
0
 def updateConfig(self, config):
     OutputPlugin.updateConfig(self, config)
     try:
         if hasattr(self.config, 'httpeventServers') is False:
             if hasattr(self._sample, 'httpeventServers'):
                 self.config.httpeventServers = self._sample.httpeventServers
             else:
                 self.logger.error(
                     'outputMode httpevent but httpeventServers not specified for sample %s' % self._sample.name)
                 raise NoServers(
                     'outputMode httpevent but httpeventServers not specified for sample %s' % self._sample.name)
         # set default output mode to round robin
         if hasattr(self.config, 'httpeventOutputMode') and self.config.httpeventOutputMode:
             self.httpeventoutputmode = config.httpeventOutputMode
         else:
             if hasattr(self._sample, 'httpeventOutputMode') and self._sample.httpeventOutputMode:
                 self.httpeventoutputmode = self._sample.httpeventOutputMode
             else:
                 self.httpeventoutputmode = 'roundrobin'
         if hasattr(self.config, 'httpeventMaxPayloadSize') and self.config.httpeventMaxPayloadSize:
             self.httpeventmaxsize = self.config.httpeventMaxPayloadSize
         else:
             if hasattr(self._sample, 'httpeventMaxPayloadSize') and self._sample.httpeventMaxPayloadSize:
                 self.httpeventmaxsize = self._sample.httpeventMaxPayloadSize
             else:
                 self.httpeventmaxsize = 10000
         self.logger.debug("Currentmax size: %s " % self.httpeventmaxsize)
         if isinstance(config.httpeventServers, str):
             self.httpeventServers = json.loads(config.httpeventServers)
         else:
             self.httpeventServers = config.httpeventServers
         self.logger.debug("Setting up the connection pool for %s in %s" % (self._sample.name, self._app))
         self.createConnections()
         self.logger.debug("Pool created.")
         self.logger.debug("Finished init of httpevent plugin.")
     except Exception as e:
         self.logger.exception(e)