Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge branch 'opendistro-for-elasticsearch:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
FreCap committed May 20, 2021
2 parents 8b942a6 + 7eeb805 commit b021028
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions sql-odbc/src/odfesqlodbc/es_communication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// clang-format off
#include "es_odbc.h"
#include "mylog.h"
#include "array"
#include <aws/core/utils/StringUtils.h>
#include <aws/core/client/RetryStrategy.h>
#include <aws/core/client/AWSClient.h>
Expand All @@ -37,6 +38,7 @@ static const std::string SQL_ENDPOINT_CLOSE_CURSOR = "/_opendistro/_sql/close";
static const std::string PLUGIN_ENDPOINT_FORMAT_JSON =
"/_cat/plugins?format=json";
static const std::string OPENDISTRO_SQL_PLUGIN_NAME = "opendistro-sql";
static const std::array< std::string, 2 > SQL_PLUGIN_COMPATIBLE_NAMES = {"opendistro-sql", "opendistro_sql"};
static const std::string ALLOCATION_TAG = "AWS_SIGV4_AUTH";
static const std::string SERVICE_NAME = "es";
static const std::string ESODBC_PROFILE_NAME = "elasticsearchodbc";
Expand Down Expand Up @@ -427,13 +429,15 @@ bool ESCommunication::IsSQLPluginInstalled(const std::string& plugin_response) {
for (auto it : plugin_array) {
if (it.has("component") && it.has("version")) {
std::string plugin_name = it.at("component").as_string();
if (!plugin_name.compare(OPENDISTRO_SQL_PLUGIN_NAME)) {
std::string sql_plugin_version =
it.at("version").as_string();
LogMsg(ES_INFO, std::string("Found SQL plugin version '"
+ sql_plugin_version + "'.")
.c_str());
return true;
for (auto compatible_name : SQL_PLUGIN_COMPATIBLE_NAMES) {
if (!plugin_name.compare(compatible_name)) {
std::string sql_plugin_version =
it.at("version").as_string();
LogMsg(ES_INFO, std::string("Found SQL plugin version '"
+ sql_plugin_version + "'.")
.c_str());
return true;
}
}
} else {
m_error_message =
Expand Down

0 comments on commit b021028

Please sign in to comment.