You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by mg...@apache.org on 2017/05/25 00:52:40 UTC
ambari git commit: AMBARI-21090 Add Log Feeder input config to HDP
3.0 hooks too (mgergely)
Repository: ambari
Updated Branches:
refs/heads/trunk 42be8ce79 -> 2f7331535
AMBARI-21090 Add Log Feeder input config to HDP 3.0 hooks too (mgergely)
Change-Id: I83da4d1987e224cf54bd352aa1731d4cf5b26174
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2f733153
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2f733153
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2f733153
Branch: refs/heads/trunk
Commit: 2f73315356551224b69bf7e9d1c9c914107ac6df
Parents: 42be8ce
Author: Miklos Gergely <mg...@hortonworks.com>
Authored: Thu May 25 02:52:29 2017 +0200
Committer: Miklos Gergely <mg...@hortonworks.com>
Committed: Thu May 25 02:52:29 2017 +0200
----------------------------------------------------------------------
.../HDP/3.0/hooks/after-INSTALL/scripts/params.py | 14 ++++++++++++++
.../after-INSTALL/scripts/shared_initialization.py | 17 +++++++++++++++++
2 files changed, 31 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f733153/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/after-INSTALL/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/after-INSTALL/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/after-INSTALL/scripts/params.py
index 5dcd39b..4a422ec 100644
--- a/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/after-INSTALL/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/after-INSTALL/scripts/params.py
@@ -28,6 +28,7 @@ from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import format_jvm_option
from resource_management.libraries.functions.version import format_stack_version
+from string import lower
config = Script.get_config()
tmp_dir = Script.get_tmp_dir()
@@ -46,6 +47,19 @@ stack_version_formatted = format_stack_version(stack_version_unformatted)
# current host stack version
current_version = default("/hostLevelParams/current_version", None)
+# service name
+service_name = config['serviceName']
+
+# logsearch configuration
+logsearch_logfeeder_conf = "/etc/ambari-logsearch-logfeeder/conf"
+
+agent_cache_dir = config['hostLevelParams']['agentCacheDir']
+service_package_folder = config['commandParams']['service_package_folder']
+logsearch_service_name = service_name.lower().replace("_", "-")
+logsearch_config_file_name = 'input.config-' + logsearch_service_name + ".json"
+logsearch_config_file_path = agent_cache_dir + "/" + service_package_folder + "/templates/" + logsearch_config_file_name + ".j2"
+logsearch_config_file_exists = os.path.isfile(logsearch_config_file_path)
+
# default hadoop params
mapreduce_libs_path = format("{stack_root}/current/hadoop-mapreduce-client/*")
hadoop_libexec_dir = stack_select.get_hadoop_dir("libexec")
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f733153/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/after-INSTALL/scripts/shared_initialization.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/after-INSTALL/scripts/shared_initialization.py b/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/after-INSTALL/scripts/shared_initialization.py
index e9f2283..36a202f 100644
--- a/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/after-INSTALL/scripts/shared_initialization.py
+++ b/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/after-INSTALL/scripts/shared_initialization.py
@@ -19,9 +19,13 @@ limitations under the License.
import os
import ambari_simplejson as json
+from ambari_jinja2 import Environment as JinjaEnvironment
from resource_management.core.logger import Logger
+from resource_management.core.resources.system import Directory, File
+from resource_management.core.source import InlineTemplate, Template
from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
+from resource_management.libraries.functions.default import default
from resource_management.libraries.functions.format import format
from resource_management.libraries.functions.version import compare_versions
from resource_management.libraries.functions.fcntl_based_process_lock import FcntlBasedProcessLock
@@ -72,6 +76,19 @@ def setup_config():
group=params.user_group,
only_if=format("ls {hadoop_conf_dir}"))
+ Directory(params.logsearch_logfeeder_conf,
+ mode=0755,
+ cd_access='a',
+ create_parents=True
+ )
+
+ if params.logsearch_config_file_exists:
+ File(format("{logsearch_logfeeder_conf}/" + params.logsearch_config_file_name),
+ content=Template(params.logsearch_config_file_path,extra_imports=[default])
+ )
+ else:
+ Logger.warning('No logsearch configuration exists at ' + params.logsearch_config_file_path)
+
def load_version(struct_out_file):
"""