ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mgerg...@apache.org
Subject ambari git commit: AMBARI-20088 Log Search should handle turned off Credential Store too (mgergely)
Date Wed, 22 Feb 2017 09:23:14 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 a67115b20 -> f416817e7


AMBARI-20088 Log Search should handle turned off Credential Store too (mgergely)

Change-Id: Icd25a6852774375f4c58d41a8796308831edb2ea


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f416817e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f416817e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f416817e

Branch: refs/heads/branch-2.5
Commit: f416817e7daefe6bc5a8c7ed00ff9e97bed97dfc
Parents: a67115b
Author: Miklos Gergely <mgergely@hortonworks.com>
Authored: Wed Feb 22 10:23:05 2017 +0100
Committer: Miklos Gergely <mgergely@hortonworks.com>
Committed: Wed Feb 22 10:23:05 2017 +0100

----------------------------------------------------------------------
 .../LOGSEARCH/0.5.0/package/scripts/params.py   |  9 ++++
 .../0.5.0/package/scripts/setup_logfeeder.py    | 43 ++++++++++++++++----
 .../0.5.0/package/scripts/setup_logsearch.py    | 35 ++++++++++++----
 .../test/python/stacks/2.4/configs/default.json |  1 +
 4 files changed, 74 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f416817e/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
index a023f2f..17c536e 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
@@ -53,9 +53,14 @@ tmp_dir = Script.get_tmp_dir()
 sudo = AMBARI_SUDO_BINARY
 security_enabled = status_params.security_enabled
 
+credential_store_enabled = False
+if 'credentialStoreEnabled' in config:
+  credential_store_enabled = config['credentialStoreEnabled']
+
 logsearch_server_conf = "/etc/ambari-logsearch-portal/conf"
 logsearch_server_keys_folder = logsearch_server_conf + "/keys"
 logsearch_logfeeder_conf = "/etc/ambari-logsearch-logfeeder/conf"
+logsearch_logfeeder_keys_folder = logsearch_logfeeder_conf + "/keys"
 
 logsearch_config_set_dir = format("{logsearch_server_conf}/solr_configsets")
 
@@ -176,8 +181,10 @@ logsearch_app_max_memory = config['configurations']['logsearch-env']['logsearch_
 
 logsearch_keystore_location = config['configurations']['logsearch-env']['logsearch_keystore_location']
 logsearch_keystore_type = config['configurations']['logsearch-env']['logsearch_keystore_type']
+logsearch_keystore_password = config['configurations']['logsearch-env']['logsearch_keystore_password']
 logsearch_truststore_location = config['configurations']['logsearch-env']['logsearch_truststore_location']
 logsearch_truststore_type = config['configurations']['logsearch-env']['logsearch_truststore_type']
+logsearch_truststore_password = config['configurations']['logsearch-env']['logsearch_truststore_password']
 
 logsearch_env_config = dict(config['configurations']['logsearch-env'])
 logsearch_env_jceks_file = os.path.join(logsearch_server_conf, 'logsearch.jceks')
@@ -312,8 +319,10 @@ logfeeder_log4j_content = config['configurations']['logfeeder-log4j']['content']
 
 logfeeder_keystore_location = config['configurations']['logfeeder-env']['logfeeder_keystore_location']
 logfeeder_keystore_type = config['configurations']['logfeeder-env']['logfeeder_keystore_type']
+logfeeder_keystore_password = config['configurations']['logfeeder-env']['logfeeder_keystore_password']
 logfeeder_truststore_location = config['configurations']['logfeeder-env']['logfeeder_truststore_location']
 logfeeder_truststore_type = config['configurations']['logfeeder-env']['logfeeder_truststore_type']
+logfeeder_truststore_password = config['configurations']['logfeeder-env']['logfeeder_truststore_password']
 
 logfeeder_env_config = dict(config['configurations']['logfeeder-env'])
 logfeeder_env_jceks_file = os.path.join(logsearch_logfeeder_conf, 'logfeeder.jceks')

http://git-wip-us.apache.org/repos/asf/ambari/blob/f416817e/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logfeeder.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logfeeder.py
b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logfeeder.py
index 6952c2c..e6e55b9 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logfeeder.py
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logfeeder.py
@@ -45,13 +45,42 @@ def setup_logfeeder():
        content=''
        )
 
-  params.logfeeder_env_config = update_credential_provider_path(params.logfeeder_env_config,
-                                                                'logfeeder-env',
-                                                                params.logfeeder_env_jceks_file,
-                                                                params.logsearch_user,
-                                                                params.user_group
-                                                                )
-  params.logfeeder_properties[HADOOP_CREDENTIAL_PROVIDER_PROPERTY_NAME] = 'jceks://file'
+ params.logfeeder_env_jceks_file
+  if params.credential_store_enabled:
+    params.logfeeder_env_config = update_credential_provider_path(params.logfeeder_env_config,
+                                                                 'logfeeder-env',
+                                                                 params.logfeeder_env_jceks_file,
+                                                                 params.logsearch_user,
+                                                                 params.user_group
+                                                                 )
+    params.logfeeder_properties[HADOOP_CREDENTIAL_PROVIDER_PROPERTY_NAME] = 'jceks://file'
+ params.logfeeder_env_jceks_file
+    File(format("{logsearch_logfeeder_keys_folder}/ks_pass.txt"),
+         action="delete"
+         )
+    File(format("{logsearch_logfeeder_keys_folder}/ts_pass.txt"),
+         action="delete"
+         )
+  else:
+    Directory(params.logsearch_logfeeder_keys_folder,
+              cd_access='a',
+              mode=0755,
+              owner=params.logsearch_user,
+              group=params.user_group
+              )
+   
+    File(format("{logsearch_logfeeder_keys_folder}/ks_pass.txt"),
+         content=params.logfeeder_keystore_password,
+         mode=0600,
+         owner=params.logsearch_user,
+         group=params.user_group
+         )
+
+    File(format("{logsearch_logfeeder_keys_folder}/ts_pass.txt"),
+         content=params.logfeeder_truststore_password,
+         mode=0600,
+         owner=params.logsearch_user,
+         group=params.user_group
+         )
+  
   PropertiesFile(format("{logsearch_logfeeder_conf}/logfeeder.properties"),
                  properties = params.logfeeder_properties
                  )

http://git-wip-us.apache.org/repos/asf/ambari/blob/f416817e/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logsearch.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logsearch.py
b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logsearch.py
index f96bfd0..7738cc1 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logsearch.py
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logsearch.py
@@ -60,13 +60,34 @@ def setup_logsearch():
        content=''
        )
 
-  params.logsearch_env_config = update_credential_provider_path(params.logsearch_env_config,
-                                                                'logsearch-env',
-                                                                params.logsearch_env_jceks_file,
-                                                                params.logsearch_user,
-                                                                params.user_group
-                                                                )
-  params.logsearch_properties[HADOOP_CREDENTIAL_PROVIDER_PROPERTY_NAME] = 'jceks://file'
+ params.logsearch_env_jceks_file
+  if params.credential_store_enabled:
+    params.logsearch_env_config = update_credential_provider_path(params.logsearch_env_config,
+                                                                 'logsearch-env',
+                                                                 params.logsearch_env_jceks_file,
+                                                                 params.logsearch_user,
+                                                                 params.user_group
+                                                                 )
+    params.logsearch_properties[HADOOP_CREDENTIAL_PROVIDER_PROPERTY_NAME] = 'jceks://file'
+ params.logsearch_env_jceks_file
+    File(format("{logsearch_server_keys_folder}/ks_pass.txt"),
+         action="delete"
+         )
+    File(format("{logsearch_server_keys_folder}/ts_pass.txt"),
+         action="delete"
+         )
+  else:
+    File(format("{logsearch_server_keys_folder}/ks_pass.txt"),
+         content=params.logsearch_keystore_password,
+         mode=0600,
+         owner= params.logsearch_user,
+         group=params.user_group
+         )
+    File(format("{logsearch_server_keys_folder}/ts_pass.txt"),
+         content=params.logsearch_truststore_password,
+         mode=0600,
+         owner= params.logsearch_user,
+         group=params.user_group
+         )
+  
   PropertiesFile(format("{logsearch_server_conf}/logsearch.properties"),
                  properties=params.logsearch_properties
                  )

http://git-wip-us.apache.org/repos/asf/ambari/blob/f416817e/ambari-server/src/test/python/stacks/2.4/configs/default.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.4/configs/default.json b/ambari-server/src/test/python/stacks/2.4/configs/default.json
index d4e6064..8822e96 100644
--- a/ambari-server/src/test/python/stacks/2.4/configs/default.json
+++ b/ambari-server/src/test/python/stacks/2.4/configs/default.json
@@ -18,6 +18,7 @@
         "java_home": "/usr/jdk64/jdk1.7.0_45",
         "db_name": "ambari"
     },
+    "credentialStoreEnabled": "true",
     "commandType": "EXECUTION_COMMAND",
     "roleParams": {},
     "serviceName": "SLIDER",


Mime
View raw message