This is an automated email from the ASF dual-hosted git repository.

oleewere pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git

commit e5eb05b75c7a862c56a586d8deb6ab96dac69ddb
Author: Oliver Szabo <[email protected]>
AuthorDate: Fri Apr 6 02:23:18 2018 +0200

    AMBARI-23199. Infra Solr custom commands: disable host checks by default 
for unsecure env
---
 .../AMBARI_INFRA_SOLR/0.1.0/package/scripts/collection.py      |  2 +-
 .../AMBARI_INFRA_SOLR/0.1.0/package/scripts/command_commons.py | 10 +++++++---
 .../AMBARI_INFRA_SOLR/0.1.0/package/scripts/migrate.py         |  2 +-
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git 
a/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/collection.py
 
b/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/collection.py
index 9e5a896..316a232 100644
--- 
a/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/collection.py
+++ 
b/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/collection.py
@@ -35,7 +35,7 @@ def backup_collection(env):
               group=params.user_group
               )
     collection_available = command_commons.is_collection_available_on_host()
-    if command_commons.check_hosts and not collection_available:
+    if not collection_available:
       Logger.info(format("No any '{collection}' replica is used on 
{params.hostname} host"))
       return
 
diff --git 
a/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/command_commons.py
 
b/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/command_commons.py
index 3dbeb77..d3ee012 100644
--- 
a/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/command_commons.py
+++ 
b/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/command_commons.py
@@ -66,7 +66,8 @@ request_async = default("/commandParams/solr_request_async", 
False)
 request_tries = int(default("/commandParams/solr_request_tries", 30))
 request_time_interval = 
int(default("/commandParams/solr_request_time_interval", 5))
 
-check_hosts = default("/commandParams/solr_check_hosts", True)
+check_hosts_default = True if params.security_enabled else False
+check_hosts = default("/commandParams/solr_check_hosts", check_hosts_default)
 
 solr_protocol = "https" if params.infra_solr_ssl_enabled else "http"
 solr_base_url = 
format("{solr_protocol}://{params.hostname}:{params.infra_solr_port}/solr")
@@ -217,5 +218,8 @@ def __get_hosts_for_collection():
   return __read_hosts_from_clusterstate_json(json_path)
 
 def is_collection_available_on_host():
-  hosts_set = __get_hosts_for_collection()
-  return params.hostname in hosts_set
\ No newline at end of file
+  if check_hosts:
+    hosts_set = __get_hosts_for_collection()
+    return params.hostname in hosts_set
+  else:
+    return True
\ No newline at end of file
diff --git 
a/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/migrate.py
 
b/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/migrate.py
index 686ac75..5d65d1d 100644
--- 
a/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/migrate.py
+++ 
b/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/migrate.py
@@ -29,7 +29,7 @@ def migrate_index(env):
   env.set_params(command_commons)
 
   collection_available = command_commons.is_collection_available_on_host()
-  if command_commons.check_hosts and not collection_available:
+  if not collection_available:
     Logger.info(format("No any '{collection}' replica is used on 
{params.hostname} host"))
     return
 

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to