Esempio n. 1
0
 def guarded(self, target, *args, **kwargs):
     import elasticsearch
     try:
         return target(*args, **kwargs)
     except elasticsearch.exceptions.AuthenticationException:
         # we know that it is just one host (see EsClientFactory)
         node = self._client.transport.hosts[0]
         msg = "The configured user could not authenticate against your Elasticsearch metrics store running on host [%s] at " \
               "port [%s] (wrong password?). Please fix the configuration in [%s]." % \
               (node["host"], node["port"], config.ConfigFile().location)
         logger.exception(msg)
         raise exceptions.SystemSetupError(msg)
     except elasticsearch.exceptions.AuthorizationException:
         node = self._client.transport.hosts[0]
         msg = "The configured user does not have enough privileges to run the operation [%s] against your Elasticsearch metrics " \
               "store running on host [%s] at port [%s]. Please adjust your x-pack configuration or specify a user with enough " \
               "privileges in the configuration in [%s]." % (target.__name__, node["host"], node["port"], config.ConfigFile().location)
         logger.exception(msg)
         raise exceptions.SystemSetupError(msg)
     except elasticsearch.exceptions.ConnectionError:
         node = self._client.transport.hosts[0]
         msg = "Could not connect to your Elasticsearch metrics store. Please check that it is running on host [%s] at port [%s] or " \
               "fix the configuration in [%s]." % (node["host"], node["port"], config.ConfigFile().location)
         logger.exception(msg)
         raise exceptions.SystemSetupError(msg)
     except elasticsearch.exceptions.ElasticsearchException:
         node = self._client.transport.hosts[0]
         msg = "An unknown error occurred while running the operation [%s] against your Elasticsearch metrics store on host [%s] at " \
               "port [%s]." % (target.__name__, node["host"], node["port"])
         logger.exception(msg)
         # this does not necessarily mean it's a system setup problem...
         raise exceptions.RallyError(msg)
Esempio n. 2
0
def remove_integration_test_config():
    for config_name in CONFIG_NAMES:
        os.remove(config.ConfigFile(config_name).location)
Esempio n. 3
0
 def copy_config(name):
     source_path = os.path.join(os.path.dirname(__file__), "resources",
                                f"rally-{name}.ini")
     f = config.ConfigFile(name)
     f.store_default_config(template_path=source_path)