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


The following commit(s) were added to refs/heads/trunk by this push:
     new 3f0fbbd  AMBARI-24281. Infra Solr migration: migrationConfigGenerator 
script failed with custom service user (#1749)
3f0fbbd is described below

commit 3f0fbbd8295760090e6f293db1c8acfa0f518cff
Author: Olivér Szabó <oleew...@gmail.com>
AuthorDate: Wed Jul 11 22:19:04 2018 +0200

    AMBARI-24281. Infra Solr migration: migrationConfigGenerator script failed 
with custom service user (#1749)
---
 .../src/main/python/migrationConfigGenerator.py                    | 7 ++++++-
 .../ambari-infra-solr-client/src/main/python/migrationHelper.py    | 3 +++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git 
a/ambari-infra/ambari-infra-solr-client/src/main/python/migrationConfigGenerator.py
 
b/ambari-infra/ambari-infra-solr-client/src/main/python/migrationConfigGenerator.py
index 51614ea..125b59d 100755
--- 
a/ambari-infra/ambari-infra-solr-client/src/main/python/migrationConfigGenerator.py
+++ 
b/ambari-infra/ambari-infra-solr-client/src/main/python/migrationConfigGenerator.py
@@ -305,7 +305,12 @@ def generate_ambari_solr_migration_ini_file(options, 
accessor, protocol):
 
   infra_solr_user = infra_solr_env_props['infra_solr_user'] if 
'infra_solr_user' in infra_solr_env_props else 'infra-solr'
   infra_solr_kerberos_keytab = 
infra_solr_env_props['infra_solr_kerberos_keytab'] if 
'infra_solr_kerberos_keytab' in infra_solr_env_props else 
'/etc/security/keytabs/ambari-infra-solr.service.keytab'
-  infra_solr_kerberos_principal = infra_solr_user + "/" + host
+  infra_solr_kerberos_principal_config = 
infra_solr_env_props['infra_solr_kerberos_principal'] if 
'infra_solr_kerberos_principal' in infra_solr_env_props else 'infra-solr'
+  infra_solr_kerberos_principal = "infra-solr/" + host
+  if '/' in infra_solr_kerberos_principal_config:
+    infra_solr_kerberos_principal = 
infra_solr_kerberos_principal_config.replace('_HOST',host)
+  else:
+    infra_solr_kerberos_principal = infra_solr_kerberos_principal_config + "/" 
+ host
   infra_solr_port = infra_solr_env_props['infra_solr_port'] if 
'infra_solr_port' in infra_solr_env_props else '8886'
 
   config.add_section('local')
diff --git 
a/ambari-infra/ambari-infra-solr-client/src/main/python/migrationHelper.py 
b/ambari-infra/ambari-infra-solr-client/src/main/python/migrationHelper.py
index ffa3493..8cb103d 100755
--- a/ambari-infra/ambari-infra-solr-client/src/main/python/migrationHelper.py
+++ b/ambari-infra/ambari-infra-solr-client/src/main/python/migrationHelper.py
@@ -157,6 +157,9 @@ def get_keytab_and_principal(config):
 
 def create_solr_api_request_command(request_url, config, output=None):
   user='infra-solr'
+  if config.has_section('infra_solr'):
+    if config.has_option('infra_solr', 'user'):
+      user=config.get('infra_solr', 'user')
   kerberos_enabled='false'
   if config.has_section('cluster') and config.has_option('cluster', 
'kerberos_enabled'):
     kerberos_enabled=config.get('cluster', 'kerberos_enabled')

Reply via email to