Repository: ambari Updated Branches: refs/heads/trunk 930cbc22e -> 0f9e6ffd2
AMBARI-8054. Version comparison fails for GlusterFS (alejandro) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0f9e6ffd Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0f9e6ffd Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0f9e6ffd Branch: refs/heads/trunk Commit: 0f9e6ffd2ec48958b89ba76904a8bf276c7acac7 Parents: 930cbc2 Author: Alejandro Fernandez <[email protected]> Authored: Fri Oct 31 17:32:49 2014 -0700 Committer: Alejandro Fernandez <[email protected]> Committed: Mon Nov 3 10:28:10 2014 -0800 ---------------------------------------------------------------------- .../resource_management/libraries/functions/version.py | 8 ++++++-- .../HDP/2.0.6/services/HIVE/package/scripts/params.py | 9 ++++----- .../HDP/2.0.6/services/HIVE/package/scripts/webhcat.py | 4 ++-- 3 files changed, 12 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/0f9e6ffd/ambari-common/src/main/python/resource_management/libraries/functions/version.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/version.py b/ambari-common/src/main/python/resource_management/libraries/functions/version.py index ee9c675..9477842 100644 --- a/ambari-common/src/main/python/resource_management/libraries/functions/version.py +++ b/ambari-common/src/main/python/resource_management/libraries/functions/version.py @@ -19,7 +19,7 @@ limitations under the License. Ambari Agent """ - +import re def _normalize(v, desired_segments=0): """ @@ -36,10 +36,14 @@ def _normalize(v, desired_segments=0): def format_hdp_stack_version(input): """ - :param input: Input string, e.g. "2.2" or "GlusterFS" + :param input: Input string, e.g. "2.2" or "GlusterFS", or "2.0.6.GlusterFS" :return: Returns a well-formatted HDP stack version of the form #.#.#.# as a string. """ if input: + input = re.sub(r'^\D+', '', input) + input = re.sub(r'\D+$', '', input) + input = input.strip('.') + strip_dots = input.replace('.', '') if strip_dots.isdigit(): normalized = _normalize(str(input)) http://git-wip-us.apache.org/repos/asf/ambari/blob/0f9e6ffd/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py index 6ab4f32..c1279d8 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py @@ -34,7 +34,7 @@ stack_is_hdp22_or_further = hdp_stack_version != "" and compare_versions(hdp_sta # Hadoop params # TODO, this logic should initialize these parameters in a file inside the HDP 2.2 stack. -if compare_versions(hdp_stack_version, "2.2.0.0") >= 0: +if stack_is_hdp22_or_further: hadoop_bin_dir = "/usr/hdp/current/hadoop-client/bin" hadoop_home = '/usr/hdp/current/hadoop-client' hive_bin = '/usr/hdp/current/hive-client/bin' @@ -53,7 +53,7 @@ else: hive_tar_file = '/usr/share/HDP-webhcat/hive.tar.gz' sqoop_tar_file = '/usr/share/HDP-webhcat/sqoop*.tar.gz' - if compare_versions(hdp_stack_version, "2.1.0.0") < 0: + if hdp_stack_version != "" and compare_versions(hdp_stack_version, "2.1.0.0") < 0: hcat_lib = '/usr/lib/hcatalog/share/hcatalog' webhcat_bin_dir = '/usr/lib/hcatalog/sbin' # for newer versions @@ -66,8 +66,7 @@ hive_conf_dir = "/etc/hive/conf" hive_client_conf_dir = "/etc/hive/conf" hive_server_conf_dir = '/etc/hive/conf.server' - -if compare_versions(hdp_stack_version, "2.1.0.0") < 0: +if hdp_stack_version != "" and compare_versions(hdp_stack_version, "2.1.0.0") < 0: hcat_conf_dir = '/etc/hcatalog/conf' config_dir = '/etc/hcatalog/conf' # for newer versions @@ -169,7 +168,7 @@ mysql_host = config['clusterHostInfo']['hive_mysql_host'] mysql_adduser_path = format("{tmp_dir}/addMysqlUser.sh") ######## Metastore Schema -if compare_versions(hdp_stack_version, "2.1.0.0") < 0: +if hdp_stack_version != "" and compare_versions(hdp_stack_version, "2.1.0.0") < 0: init_metastore_schema = False else: init_metastore_schema = True http://git-wip-us.apache.org/repos/asf/ambari/blob/0f9e6ffd/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/webhcat.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/webhcat.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/webhcat.py index 6156ccf..c02bf74 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/webhcat.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/webhcat.py @@ -31,7 +31,7 @@ from resource_management.libraries.functions.dynamic_variable_interpretation imp def webhcat(): import params - if compare_versions(params.hdp_stack_version, "2.2.0.0") < 0: + if params.hdp_stack_version != "" and compare_versions(params.hdp_stack_version, "2.2.0.0") < 0: params.HdfsDirectory(params.webhcat_apps_dir, action="create_delayed", owner=params.webhcat_user, @@ -80,7 +80,7 @@ def webhcat(): ) # TODO, these checks that are specific to HDP 2.2 and greater should really be in a script specific to that stack. - if compare_versions(params.hdp_stack_version, "2.2.0.0") >= 0: + if params.hdp_stack_version != "" and compare_versions(params.hdp_stack_version, "2.2.0.0") >= 0: copy_tarballs_to_hdfs('hive', params.webhcat_user, params.hdfs_user, params.user_group) copy_tarballs_to_hdfs('pig', params.webhcat_user, params.hdfs_user, params.user_group) copy_tarballs_to_hdfs('hadoop-streaming', params.webhcat_user, params.hdfs_user, params.user_group)
