Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B2AC42004A0 for ; Wed, 16 Aug 2017 19:38:02 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id B0D931692F8; Wed, 16 Aug 2017 17:38:02 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 32D691692F6 for ; Wed, 16 Aug 2017 19:38:01 +0200 (CEST) Received: (qmail 1565 invoked by uid 500); 16 Aug 2017 17:37:58 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 1556 invoked by uid 99); 16 Aug 2017 17:37:58 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Aug 2017 17:37:58 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C1701E9686; Wed, 16 Aug 2017 17:37:57 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: smohanty@apache.org To: commits@ambari.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: ambari git commit: AMBARI-21045. Enable Storm's AutoTGT configs in secure mode (Sriharsha Chintalapani via smohanty)"" Date: Wed, 16 Aug 2017 17:37:57 +0000 (UTC) archived-at: Wed, 16 Aug 2017 17:38:02 -0000 Repository: ambari Updated Branches: refs/heads/branch-2.6 d6d2a3b63 -> c126b37e6 AMBARI-21045. Enable Storm's AutoTGT configs in secure mode (Sriharsha Chintalapani via smohanty)"" This reverts commit 96e5ea566037e7874e815000966495145974f69c. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c126b37e Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c126b37e Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c126b37e Branch: refs/heads/branch-2.6 Commit: c126b37e67be5304cfbd8b5be6b750fb3c1ca329 Parents: d6d2a3b Author: Sumit Mohanty Authored: Tue Aug 15 16:58:33 2017 -0700 Committer: Sumit Mohanty Committed: Wed Aug 16 10:37:35 2017 -0700 ---------------------------------------------------------------------- .../STORM/1.1.0/configuration/storm-env.xml | 54 ++++++++++++ .../STORM/1.1.0/configuration/storm-site.xml | 48 ----------- .../stacks/HDP/2.3/upgrades/config-upgrade.xml | 7 ++ .../HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml | 4 + .../stacks/HDP/2.3/upgrades/upgrade-2.6.xml | 1 + .../stacks/HDP/2.4/upgrades/config-upgrade.xml | 7 ++ .../HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml | 4 + .../stacks/HDP/2.4/upgrades/upgrade-2.6.xml | 2 + .../stacks/HDP/2.5/upgrades/config-upgrade.xml | 7 ++ .../HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml | 4 + .../stacks/HDP/2.5/upgrades/upgrade-2.6.xml | 1 + .../stacks/HDP/2.6/services/stack_advisor.py | 87 +++++++++++++++++++- .../stacks/HDP/2.6/upgrades/config-upgrade.xml | 6 ++ .../HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml | 4 + .../stacks/HDP/2.6/upgrades/upgrade-2.6.xml | 1 + .../src/main/resources/stacks/stack_advisor.py | 18 ++++ 16 files changed, 204 insertions(+), 51 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/c126b37e/ambari-server/src/main/resources/common-services/STORM/1.1.0/configuration/storm-env.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/1.1.0/configuration/storm-env.xml b/ambari-server/src/main/resources/common-services/STORM/1.1.0/configuration/storm-env.xml new file mode 100644 index 0000000..2ce560d --- /dev/null +++ b/ambari-server/src/main/resources/common-services/STORM/1.1.0/configuration/storm-env.xml @@ -0,0 +1,54 @@ + + + + + + + content + storm-env template + This is the jinja template for storm-env.sh file + +#!/bin/bash + +# Set Storm specific environment variables here. + +# The java implementation to use. +export JAVA_HOME={{java64_home}} + +export STORM_CONF_DIR={{conf_dir}} +export STORM_HOME={{storm_component_home_dir}} +export STORM_JAR_JVM_OPTS={{jar_jvm_opts}} + +#set storm-auto creds +# check if storm_jaas.conf in config , only enable storm_auto_creds in secure mode. +STORM_JAAS_CONF=$STORM_HOME/conf/storm_jaas.conf +STORM_AUTOCREDS_LIB_DIR=$STORM_HOME/external/storm-autocreds + +if [ -f $STORM_JAAS_CONF ] && [ -d $STORM_AUTOCREDS_LIB_DIR ]; then + export STORM_EXT_CLASSPATH=$STORM_AUTOCREDS_LIB_DIR +fi + + + content + + + + http://git-wip-us.apache.org/repos/asf/ambari/blob/c126b37e/ambari-server/src/main/resources/common-services/STORM/1.1.0/configuration/storm-site.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/1.1.0/configuration/storm-site.xml b/ambari-server/src/main/resources/common-services/STORM/1.1.0/configuration/storm-site.xml deleted file mode 100644 index b2e9acb..0000000 --- a/ambari-server/src/main/resources/common-services/STORM/1.1.0/configuration/storm-site.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - nimbus.impersonation.acl - - The ImpersonationAuthorizer uses nimbus.impersonation.acl as the acl to authorize users. Following is a sample nimbus config for supporting impersonation: - nimbus.impersonation.acl: - impersonating_user1: - hosts: - [comma separated list of hosts from which impersonating_user1 is allowed to impersonate other users] - groups: - [comma separated list of groups whose users impersonating_user1 is allowed to impersonate] - impersonating_user2: - hosts: - [comma separated list of hosts from which impersonating_user2 is allowed to impersonate other users] - groups: - [comma separated list of groups whose users impersonating_user2 is allowed to impersonate] - - - - - streamline-env - streamline_principal_name - - - - - http://git-wip-us.apache.org/repos/asf/ambari/blob/c126b37e/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml index d8e2d7d..0c4106e 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml @@ -664,6 +664,13 @@ replace-with="${sys:workers.artifacts}/${sys:storm.id}/${sys:worker.port}/${sys:logfile.name}"/> + + storm-site + + + + + http://git-wip-us.apache.org/repos/asf/ambari/blob/c126b37e/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml index 498f423..bf4f595 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml @@ -638,6 +638,10 @@ + + + + http://git-wip-us.apache.org/repos/asf/ambari/blob/c126b37e/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml index 538223a..48f86e4 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml @@ -1131,6 +1131,7 @@ + http://git-wip-us.apache.org/repos/asf/ambari/blob/c126b37e/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/config-upgrade.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/config-upgrade.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/config-upgrade.xml index 83a0a1e..3e62fb1 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/config-upgrade.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/config-upgrade.xml @@ -483,6 +483,13 @@ + + storm-site + + + + + http://git-wip-us.apache.org/repos/asf/ambari/blob/c126b37e/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml index 0fd5c5b..fccec7e 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml @@ -563,6 +563,10 @@ + + + + http://git-wip-us.apache.org/repos/asf/ambari/blob/c126b37e/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml index 00a10c5..365e17a 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml @@ -1093,6 +1093,8 @@ + + http://git-wip-us.apache.org/repos/asf/ambari/blob/c126b37e/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/config-upgrade.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/config-upgrade.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/config-upgrade.xml index 8664584..970e19f 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/config-upgrade.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/config-upgrade.xml @@ -63,6 +63,13 @@ + + storm-site + + + + + http://git-wip-us.apache.org/repos/asf/ambari/blob/c126b37e/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml index 7074e77..68f4350 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml @@ -416,6 +416,10 @@ + + + + http://git-wip-us.apache.org/repos/asf/ambari/blob/c126b37e/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml index 995a1d3..88afb45 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml @@ -1030,6 +1030,7 @@ + http://git-wip-us.apache.org/repos/asf/ambari/blob/c126b37e/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py index cc5fa92..974b10c 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py @@ -41,11 +41,92 @@ class HDP26StackAdvisor(HDP25StackAdvisor): "HIVE": self.recommendHIVEConfigurations, "HBASE": self.recommendHBASEConfigurations, "YARN": self.recommendYARNConfigurations, - "KAFKA": self.recommendKAFKAConfigurations + "KAFKA": self.recommendKAFKAConfigurations, + "BEACON": self.recommendBEACONConfigurations, + "STORM": self.recommendSTORMConfigurations } parentRecommendConfDict.update(childRecommendConfDict) return parentRecommendConfDict + def recommendSTORMConfigurations(self, configurations, clusterData, services, hosts): + """ + In HDF-2.6.1 we introduced a new way of doing Auto Credentials with services such as + HDFS, HIVE, HBASE. This method will update the required configs for autocreds if the users installs + STREAMLINE service. + """ + super(HDP26StackAdvisor, self).recommendStormConfigurations(configurations, clusterData, services, hosts) + storm_site = self.getServicesSiteProperties(services, "storm-site") + storm_env = self.getServicesSiteProperties(services, "storm-env") + putStormSiteProperty = self.putProperty(configurations, "storm-site", services) + putStormSiteAttributes = self.putPropertyAttribute(configurations, "storm-site") + security_enabled = self.isSecurityEnabled(services) + servicesList = [service["StackServices"]["service_name"] for service in services["services"]] + + if storm_env and storm_site and security_enabled and 'STREAMLINE' in servicesList: + storm_nimbus_impersonation_acl = storm_site["nimbus.impersonation.acl"] if "nimbus.impersonation.acl" in storm_site else None + streamline_env = self.getServicesSiteProperties(services, "streamline-env") + _streamline_principal_name = streamline_env['streamline_principal_name'] if 'streamline_principal_name' in streamline_env else None + if _streamline_principal_name is not None and storm_nimbus_impersonation_acl is not None: + streamline_bare_principal = get_bare_principal(_streamline_principal_name) + storm_nimbus_impersonation_acl.replace('{{streamline_bare_principal}}', streamline_bare_principal) + putStormSiteProperty('nimbus.impersonation.acl', storm_nimbus_impersonation_acl) + + storm_nimbus_autocred_plugin_classes = storm_site["nimbus.autocredential.plugins.classes"] if "nimbus.autocredential.plugins.classes" in storm_site else None + if storm_nimbus_autocred_plugin_classes is not None: + new_storm_nimbus_autocred_plugin_classes = ['org.apache.storm.hdfs.security.AutoHDFS', + 'org.apache.storm.hbase.security.AutoHBase', + 'org.apache.storm.hive.security.AutoHive'] + new_conf = DefaultStackAdvisor.appendToYamlString(storm_nimbus_autocred_plugin_classes, + new_storm_nimbus_autocred_plugin_classes) + + putStormSiteProperty("nimbus.autocredential.plugins.classes", new_conf) + else: + putStormSiteProperty("nimbus.autocredential.plugins.classes", "['org.apache.storm.hdfs.security.AutoHDFS', 'org.apache.storm.hbase.security.AutoHBase', 'org.apache.storm.hive.security.AutoHive']") + + + storm_nimbus_credential_renewer_classes = storm_site["nimbus.credential.renewers.classes"] if "nimbus.credential.renewers.classes" in storm_site else None + if storm_nimbus_credential_renewer_classes is not None: + new_storm_nimbus_credential_renewer_classes_array = ['org.apache.storm.hdfs.security.AutoHDFS', + 'org.apache.storm.hbase.security.AutoHBase', + 'org.apache.storm.hive.security.AutoHive'] + new_conf = DefaultStackAdvisor.appendToYamlString(storm_nimbus_credential_renewer_classes, + new_storm_nimbus_credential_renewer_classes_array) + putStormSiteProperty("nimbus.autocredential.plugins.classes", new_conf) + else: + putStormSiteProperty("nimbus.credential.renewers.classes", "['org.apache.storm.hdfs.security.AutoHDFS', 'org.apache.storm.hbase.security.AutoHBase', 'org.apache.storm.hive.security.AutoHive']") + putStormSiteProperty("nimbus.credential.renewers.freq.secs", "82800") + pass + + def recommendBEACONConfigurations(self, configurations, clusterData, services, hosts): + beaconEnvProperties = self.getSiteProperties(services['configurations'], 'beacon-env') + putbeaconEnvProperty = self.putProperty(configurations, "beacon-env", services) + + # database URL and driver class recommendations + if beaconEnvProperties and self.checkSiteProperties(beaconEnvProperties, 'beacon_store_driver') and self.checkSiteProperties(beaconEnvProperties, 'beacon_database'): + putbeaconEnvProperty('beacon_store_driver', self.getDBDriver(beaconEnvProperties['beacon_database'])) + if beaconEnvProperties and self.checkSiteProperties(beaconEnvProperties, 'beacon_store_db_name', 'beacon_store_url') and self.checkSiteProperties(beaconEnvProperties, 'beacon_database'): + beaconServerHost = self.getHostWithComponent('BEACON', 'BEACON_SERVER', services, hosts) + beaconDBConnectionURL = beaconEnvProperties['beacon_store_url'] + protocol = self.getProtocol(beaconEnvProperties['beacon_database']) + oldSchemaName = getOldValue(self, services, "beacon-env", "beacon_store_db_name") + oldDBType = getOldValue(self, services, "beacon-env", "beacon_database") + # under these if constructions we are checking if beacon server hostname available, + # if it's default db connection url with "localhost" or if schema name was changed or if db type was changed (only for db type change from default mysql to existing mysql) + # or if protocol according to current db type differs with protocol in db connection url(other db types changes) + if beaconServerHost is not None: + if (beaconDBConnectionURL and "//localhost" in beaconDBConnectionURL) or oldSchemaName or oldDBType or (protocol and beaconDBConnectionURL and not beaconDBConnectionURL.startswith(protocol)): + dbConnection = self.getDBConnectionStringBeacon(beaconEnvProperties['beacon_database']).format(beaconServerHost['Hosts']['host_name'], beaconEnvProperties['beacon_store_db_name']) + putbeaconEnvProperty('beacon_store_url', dbConnection) + + def getDBConnectionStringBeacon(self, databaseType): + driverDict = { + 'NEW DERBY DATABASE': 'jdbc:derby:${{beacon.data.dir}}/${{beacon.store.db.name}}-db;create=true', + 'EXISTING MYSQL DATABASE': 'jdbc:mysql://{0}/{1}', + 'EXISTING MYSQL / MARIADB DATABASE': 'jdbc:mysql://{0}/{1}', + 'EXISTING ORACLE DATABASE': 'jdbc:oracle:thin:@//{0}:1521/{1}' + } + return driverDict.get(databaseType.upper()) + def recommendAtlasConfigurations(self, configurations, clusterData, services, hosts): super(HDP26StackAdvisor, self).recommendAtlasConfigurations(configurations, clusterData, services, hosts) servicesList = [service["StackServices"]["service_name"] for service in services["services"]] @@ -401,9 +482,9 @@ class HDP26StackAdvisor(HDP25StackAdvisor): propertyValue = "https://"+webapp_address+"/ws/v1/applicationhistory" Logger.info("validateYarnSiteConfigurations: recommended value for webservice url"+services["configurations"]["yarn-site"]["properties"]["yarn.log.server.web-service.url"]) if services["configurations"]["yarn-site"]["properties"]["yarn.log.server.web-service.url"] != propertyValue: - validationItems.append( + validationItems = [ {"config-name": "yarn.log.server.web-service.url", - "item": self.getWarnItem("Value should be %s" % propertyValue)}) + "item": self.getWarnItem("Value should be %s" % propertyValue)}] return self.toConfigurationValidationProblems(validationItems, "yarn-site") def validateDruidHistoricalConfigurations(self, properties, recommendedDefaults, configurations, services, hosts): http://git-wip-us.apache.org/repos/asf/ambari/blob/c126b37e/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml index a874fa7..9cb625c 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml @@ -111,6 +111,12 @@ + + storm-site + + + + http://git-wip-us.apache.org/repos/asf/ambari/blob/c126b37e/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml index 0d9a746..c427318 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml @@ -328,6 +328,10 @@ + + + + http://git-wip-us.apache.org/repos/asf/ambari/blob/c126b37e/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml index b5c88de..af885e1 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml @@ -965,6 +965,7 @@ + http://git-wip-us.apache.org/repos/asf/ambari/blob/c126b37e/ambari-server/src/main/resources/stacks/stack_advisor.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/stack_advisor.py b/ambari-server/src/main/resources/stacks/stack_advisor.py index ccbb676..8ccbaba 100644 --- a/ambari-server/src/main/resources/stacks/stack_advisor.py +++ b/ambari-server/src/main/resources/stacks/stack_advisor.py @@ -1375,3 +1375,21 @@ class DefaultStackAdvisor(StackAdvisor): if recommendation: put_f(name, ",".join(recommendation)) + + @classmethod + def appendToYamlString(cls, yaml_string, list_classes): + updated_yaml_string = "" + try: + strip_yaml_str = re.sub('[\[\]\']', ' ', yaml_string) + klass_array = [x.strip() for x in strip_yaml_str.split(',')] + if yaml_string: + for klass in list_classes: + klass = klass.strip() + klass_array.append(klass) + klass_set = set(klass_array) + klass_list = [("'" + e + "'") for e in klass_set] + updated_yaml_string = "[" + ",".join(klass_list) + "]" + except Exception: + klass_list = [("'" + e + "'") for e in list_classes] + updated_yaml_string = "[" + ",".join(klass_list) + "]" + return updated_yaml_string