Beispiel #1
0
    def elasticsearch_template_delete(self, env):
        from params import params
        env.set_params(params)
        Logger.info("Deleting Elasticsearch index templates")

        commands = IndexingCommands(params)
        for template_name in commands.get_templates():
            # delete the index template
            cmd = "curl -s -XDELETE \"http://{0}/_template/{1}\""
            Execute(cmd.format(params.es_http_url, template_name),
                    logoutput=True)
    def elasticsearch_template_delete(self, env):
        from params import params
        env.set_params(params)
        Logger.info("Deleting Elasticsearch index templates")

        commands = IndexingCommands(params)
        for template_name in commands.get_templates():
            # delete the index template
            cmd = "curl -s -XDELETE \"http://{0}/_template/{1}\""
            Execute(
              cmd.format(params.es_http_url, template_name),
              logoutput=True)
Beispiel #3
0
    def elasticsearch_template_install(self, env):
        from params import params
        env.set_params(params)
        Logger.info("Installing Elasticsearch index templates")

        commands = IndexingCommands(params)
        for template_name, template_path in commands.get_templates().iteritems():

            # install the index template
            File(template_path, mode=0755, content=StaticFile("{0}.template".format(template_name)))
            cmd = "curl -s -XPOST http://{0}/_template/{1} -d @{2}"
            Execute(
              cmd.format(params.es_http_url, template_name, template_path),
              logoutput=True)
Beispiel #4
0
    def elasticsearch_template_install(self, env):
        from params import params
        env.set_params(params)
        Logger.info("Installing Elasticsearch index templates")

        try:
            metron_service.check_indexer_parameters()
            commands = IndexingCommands(params)
            for template_name, template_path in commands.get_templates().iteritems():
                # install the index template
                File(template_path, mode=0755, content=StaticFile("{0}.template".format(template_name)))
                cmd = "curl -s -XPOST http://{0}/_template/{1} -d @{2}"
                Execute(
                  cmd.format(params.es_http_url, template_name, template_path),
                  logoutput=True)
            return True

        except Exception as e:
            msg = "WARNING: Elasticsearch index templates could not be installed.  " \
                  "Is Elasticsearch running?  Will reattempt install on next start.  error={0}"
            Logger.warning(msg.format(e))
            return False