This is an automated email from the ASF dual-hosted git repository. jluniya pushed a commit to branch branch-feature-AMBARI-14714 in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by this push: new 1c9930f AMBARI-23503: Fix installation issues caused by execution_command library (jluniya) (#925) 1c9930f is described below commit 1c9930f0c62cf9cb833da7af90afe0f19e3607b4 Author: jayush <jay...@gmail.com> AuthorDate: Fri Apr 6 12:40:11 2018 -0700 AMBARI-23503: Fix installation issues caused by execution_command library (jluniya) (#925) Change-Id: I46a1a09b20d651de2fea28b7e20f0f0d8be30a79 --- .../libraries/execution_command/execution_command.py | 6 ++++-- .../libraries/execution_command/module_configs.py | 11 +++++++---- .../resources/stack-hooks/after-INSTALL/scripts/params.py | 8 +++++--- .../main/resources/stack-hooks/before-ANY/scripts/params.py | 4 ++-- .../resources/stack-hooks/before-INSTALL/scripts/params.py | 2 +- .../main/resources/stack-hooks/before-START/scripts/params.py | 5 +++-- 6 files changed, 22 insertions(+), 14 deletions(-) diff --git a/ambari-common/src/main/python/resource_management/libraries/execution_command/execution_command.py b/ambari-common/src/main/python/resource_management/libraries/execution_command/execution_command.py index f6b52d7..4a6485c 100644 --- a/ambari-common/src/main/python/resource_management/libraries/execution_command/execution_command.py +++ b/ambari-common/src/main/python/resource_management/libraries/execution_command/execution_command.py @@ -49,6 +49,8 @@ class ExecutionCommand(object): value = self._execution_command try: for sub_key in sub_keys: + if not sub_key in value: + return default_value value = value[sub_key] return value except: @@ -126,8 +128,8 @@ class ExecutionCommand(object): def get_mysql_jdbc_url(self): return self.__get_value('ambariLevelParams/mysql_jdbc_url') - def get_agent_stack_retry_count_on_unavailability(self): - return self.__get_value('ambariLevelParams/agent_stack_retry_count', 5) + def get_agent_stack_retry_count(self): + return int(self.__get_value('ambariLevelParams/agent_stack_retry_count', 5)) def check_agent_stack_want_retry_on_unavailability(self): return self.__get_value('ambariLevelParams/agent_stack_retry_on_unavailability') diff --git a/ambari-common/src/main/python/resource_management/libraries/execution_command/module_configs.py b/ambari-common/src/main/python/resource_management/libraries/execution_command/module_configs.py index d315b50..82ad6eb 100644 --- a/ambari-common/src/main/python/resource_management/libraries/execution_command/module_configs.py +++ b/ambari-common/src/main/python/resource_management/libraries/execution_command/module_configs.py @@ -31,12 +31,16 @@ class ModuleConfigs(object): self.__module_config_attributes = configAttributes def get_all_attributes(self, module_name, config_type): + if config_type not in self.__module_config_attributes: + return {} try: return self.__module_config_attributes[config_type] except: return {} def get_all_properties(self, module_name, config_type): + if config_type not in self.__module_configs: + return {} try: return self.__module_configs[config_type] except: @@ -52,11 +56,10 @@ class ModuleConfigs(object): return properties def get_property_value(self, module_name, config_type, property_name, default=None): + if config_type not in self.__module_configs or property_name not in self.__module_configs[config_type]: + return default try: - if property_name: - return self.__module_configs[config_type][property_name] - else: - return self.__module_configs[config_type] + return self.__module_configs[config_type][property_name] except: return default diff --git a/ambari-server/src/main/resources/stack-hooks/after-INSTALL/scripts/params.py b/ambari-server/src/main/resources/stack-hooks/after-INSTALL/scripts/params.py index 9434c13..f6b02fb 100644 --- a/ambari-server/src/main/resources/stack-hooks/after-INSTALL/scripts/params.py +++ b/ambari-server/src/main/resources/stack-hooks/after-INSTALL/scripts/params.py @@ -44,7 +44,9 @@ host_sys_prepped = execution_command.is_host_system_prepared() sudo = AMBARI_SUDO_BINARY -stack_version_formatted = execution_command.get_mpack_version() +stack_version_unformatted = execution_command.get_mpack_version() +stack_version_formatted = format_stack_version(stack_version_unformatted) + major_stack_version = get_major_version(stack_version_formatted) # service name @@ -84,8 +86,8 @@ hadoop_heapsize = module_configs.get_property_value(module_name, 'hadoop-env', ' namenode_heapsize = module_configs.get_property_value(module_name, 'hadoop-env', 'namenode_heapsize') namenode_opt_newsize = module_configs.get_property_value(module_name, 'hadoop-env', 'namenode_opt_newsize') namenode_opt_maxnewsize = module_configs.get_property_value(module_name, 'hadoop-env', 'namenode_opt_maxnewsize') -namenode_opt_permsize = format_jvm_option_value(module_configs.get_property_value(module_name, 'hadoop-env', 'namenode_opt_permsize', '128m')) -namenode_opt_maxpermsize = format_jvm_option_value(module_configs.get_property_value(module_name, 'hadoop-env', 'namenode_opt_maxpermsize', '256m')) +namenode_opt_permsize = format_jvm_option_value(module_configs.get_property_value(module_name, 'hadoop-env', 'namenode_opt_permsize', '128m'), '128m') +namenode_opt_maxpermsize = format_jvm_option_value(module_configs.get_property_value(module_name, 'hadoop-env', 'namenode_opt_maxpermsize', '256m'), '256m') jtnode_opt_newsize = "200m" jtnode_opt_maxnewsize = "200m" diff --git a/ambari-server/src/main/resources/stack-hooks/before-ANY/scripts/params.py b/ambari-server/src/main/resources/stack-hooks/before-ANY/scripts/params.py index 2f88583..7265ca0 100644 --- a/ambari-server/src/main/resources/stack-hooks/before-ANY/scripts/params.py +++ b/ambari-server/src/main/resources/stack-hooks/before-ANY/scripts/params.py @@ -159,8 +159,8 @@ hadoop_heapsize = module_configs.get_property_value(module_name, 'hadoop-env', ' namenode_heapsize = module_configs.get_property_value(module_name, 'hadoop-env', 'namenode_heapsize') namenode_opt_newsize = module_configs.get_property_value(module_name, 'hadoop-env', 'namenode_opt_newsize') namenode_opt_maxnewsize = module_configs.get_property_value(module_name, 'hadoop-env', 'namenode_opt_maxnewsize') -namenode_opt_permsize = format_jvm_option_value(module_configs.get_property_value(module_name, 'hadoop-env', 'namenode_opt_permsize', '128m')) -namenode_opt_maxpermsize = format_jvm_option_value(module_configs.get_property_value(module_name, 'hadoop-env', 'namenode_opt_maxpermsize', '256m')) +namenode_opt_permsize = format_jvm_option_value(module_configs.get_property_value(module_name, 'hadoop-env', 'namenode_opt_permsize', '128m'), '128m') +namenode_opt_maxpermsize = format_jvm_option_value(module_configs.get_property_value(module_name, 'hadoop-env', 'namenode_opt_maxpermsize', '256m'), '256m') jtnode_opt_newsize = "200m" jtnode_opt_maxnewsize = "200m" diff --git a/ambari-server/src/main/resources/stack-hooks/before-INSTALL/scripts/params.py b/ambari-server/src/main/resources/stack-hooks/before-INSTALL/scripts/params.py index abb00df..f8d0c3a 100644 --- a/ambari-server/src/main/resources/stack-hooks/before-INSTALL/scripts/params.py +++ b/ambari-server/src/main/resources/stack-hooks/before-INSTALL/scripts/params.py @@ -36,7 +36,7 @@ sudo = AMBARI_SUDO_BINARY stack_version_unformatted = execution_command.get_mpack_version() agent_stack_retry_on_unavailability = execution_command.check_agent_stack_want_retry_on_unavailability() -agent_stack_retry_count = execution_command.get_agent_stack_retry_count_on_unavailability() +agent_stack_retry_count = execution_command.get_agent_stack_retry_count() stack_version_formatted = format_stack_version(stack_version_unformatted) #users and groups diff --git a/ambari-server/src/main/resources/stack-hooks/before-START/scripts/params.py b/ambari-server/src/main/resources/stack-hooks/before-START/scripts/params.py index 68533b5..dbba59b 100644 --- a/ambari-server/src/main/resources/stack-hooks/before-START/scripts/params.py +++ b/ambari-server/src/main/resources/stack-hooks/before-START/scripts/params.py @@ -38,6 +38,7 @@ from resource_management.libraries.execution_command import module_configs from ambari_commons.constants import AMBARI_SUDO_BINARY from resource_management.libraries.functions.cluster_settings import get_cluster_setting_value +config = Script.get_config() execution_command = Script.get_execution_command() module_configs = Script.get_module_configs() module_name = execution_command.get_module_name() @@ -210,8 +211,8 @@ hadoop_heapsize = module_configs.get_property_value(module_name, 'hadoop-env', ' namenode_heapsize = module_configs.get_property_value(module_name, 'hadoop-env', 'namenode_heapsize') namenode_opt_newsize = module_configs.get_property_value(module_name, 'hadoop-env', 'namenode_opt_newsize') namenode_opt_maxnewsize = module_configs.get_property_value(module_name, 'hadoop-env', 'namenode_opt_maxnewsize') -namenode_opt_permsize = format_jvm_option_value(module_configs.get_property_value(module_name, 'hadoop-env', 'namenode_opt_permsize', '128m')) -namenode_opt_maxpermsize = format_jvm_option_value(module_configs.get_property_value(module_name, 'hadoop-env', 'namenode_opt_maxpermsize', '256m')) +namenode_opt_permsize = format_jvm_option_value(module_configs.get_property_value(module_name, 'hadoop-env', 'namenode_opt_permsize', '128m'), '128m') +namenode_opt_maxpermsize = format_jvm_option_value(module_configs.get_property_value(module_name, 'hadoop-env', 'namenode_opt_maxpermsize', '256m'), '256m') jtnode_opt_newsize = "200m" jtnode_opt_maxnewsize = "200m" -- To stop receiving notification emails like this one, please contact jlun...@apache.org.