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 A686C200B65 for ; Wed, 17 Aug 2016 15:16:58 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A51B3160A8C; Wed, 17 Aug 2016 13:16:58 +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 C5C83160A86 for ; Wed, 17 Aug 2016 15:16:57 +0200 (CEST) Received: (qmail 13954 invoked by uid 500); 17 Aug 2016 13:16:57 -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 13945 invoked by uid 99); 17 Aug 2016 13:16:56 -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, 17 Aug 2016 13:16:56 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id DE052DFBD7; Wed, 17 Aug 2016 13:16:56 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: onechiporenko@apache.org To: commits@ambari.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: ambari git commit: AMBARI-18131. UI - atlas.rest.address needs to be recalculated by StackAdvisor whenever AtlasServer is added/moved/deleted (onechiporenko) Date: Wed, 17 Aug 2016 13:16:56 +0000 (UTC) archived-at: Wed, 17 Aug 2016 13:16:58 -0000 Repository: ambari Updated Branches: refs/heads/trunk 9911267f0 -> 42fd20de0 AMBARI-18131. UI - atlas.rest.address needs to be recalculated by StackAdvisor whenever AtlasServer is added/moved/deleted (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/42fd20de Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/42fd20de Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/42fd20de Branch: refs/heads/trunk Commit: 42fd20de03c0c665b5659f47b758eabc7681e3bd Parents: 9911267 Author: Oleg Nechiporenko Authored: Wed Aug 17 16:10:04 2016 +0300 Committer: Oleg Nechiporenko Committed: Wed Aug 17 16:10:04 2016 +0300 ---------------------------------------------------------------------- .../app/controllers/wizard/step7_controller.js | 11 ++++ .../app/utils/configs/config_initializer.js | 28 +++++++++- .../utils/configs/config_initializer_test.js | 58 +++++++++++++++++++- 3 files changed, 95 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/42fd20de/ambari-web/app/controllers/wizard/step7_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js index a35ea00..7c213fd 100644 --- a/ambari-web/app/controllers/wizard/step7_controller.js +++ b/ambari-web/app/controllers/wizard/step7_controller.js @@ -221,9 +221,15 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E var dependencies = {}; var hiveMetastore = App.configsCollection.getConfigByName('hive.metastore.uris', 'hive-site.xml'); var clientPort = App.configsCollection.getConfigByName('clientPort', 'zoo.cfg.xml'); + var atlasTls = App.configsCollection.getConfigByName('atlas.enableTLS', 'application-properties.xml'); + var atlasHttpPort = App.configsCollection.getConfigByName('atlas.server.http.port', 'application-properties.xml'); + var atlasHttpsPort = App.configsCollection.getConfigByName('atlas.server.https.port', 'application-properties.xml'); if (hiveMetastore) dependencies['hive.metastore.uris'] = hiveMetastore.recommendedValue; if (clientPort) dependencies.clientPort = clientPort.recommendedValue; + if (atlasTls) dependencies['atlas.enableTLS'] = atlasTls.recommendedValue; + if (atlasHttpPort) dependencies['atlas.server.http.port'] = atlasHttpPort.recommendedValue; + if (atlasHttpsPort) dependencies['atlas.server.https.port'] = atlasHttpsPort.recommendedValue; return dependencies; }.property(), @@ -1041,6 +1047,11 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E this.get('configDependencies').clientPort = config.savedValue; } } + if (config.filename === 'application-properties.xml') { + if (this.get('configDependencies').hasOwnProperty(config.name)) { + this.get('configDependencies')[config.name] = config.savedValue; + } + } }, /** http://git-wip-us.apache.org/repos/asf/ambari/blob/42fd20de/ambari-web/app/utils/configs/config_initializer.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/configs/config_initializer.js b/ambari-web/app/utils/configs/config_initializer.js index 3446c86..cb5b41f 100644 --- a/ambari-web/app/utils/configs/config_initializer.js +++ b/ambari-web/app/utils/configs/config_initializer.js @@ -141,7 +141,8 @@ App.ConfigInitializer = App.ConfigInitializerClass.create(App.MountPointsBasedIn 'hbase.zookeeper.quorum': '_initHBaseZookeeperQuorum', 'yarn.resourcemanager.zk-address': '_initYarnRMzkAddress', 'RANGER_HOST': '_initRangerHost', - 'hive.metastore.uris': '_initHiveMetastoreUris' + 'hive.metastore.uris': '_initHiveMetastoreUris', + 'atlas.rest.address': '_initAtlasRestAddress' }, initializerTypes: [ @@ -313,6 +314,31 @@ App.ConfigInitializer = App.ConfigInitializerClass.create(App.MountPointsBasedIn }, /** + * Unique initializer for atlas.rest.address + * + * @param {configProperty} configProperty + * @param {topologyLocalDB} localDB + * @param {object} dependencies + * @return {Object} + * @private + */ + _initAtlasRestAddress: function (configProperty, localDB, dependencies) { + var atlasTls = dependencies['atlas.enableTLS']; + var httpPort = dependencies['atlas.server.http.port']; + var httpsPort = dependencies['atlas.server.https.port']; + var protocol = atlasTls ? 'https': 'http'; + var port = atlasTls ? httpsPort : httpPort; + var value = localDB.masterComponentHosts.filterProperty('component', 'ZOOKEEPER_SERVER').map(function (component) { + return protocol + '://' + component.hostName + ':' + port; + }).join(','); + Em.setProperties(configProperty, { + value: value, + recommendedValue: value + }); + return configProperty; + }, + + /** * Get hive.metastore.uris initial value * * @param {object[]} hosts http://git-wip-us.apache.org/repos/asf/ambari/blob/42fd20de/ambari-web/test/utils/configs/config_initializer_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/utils/configs/config_initializer_test.js b/ambari-web/test/utils/configs/config_initializer_test.js index a5031b1..e951b34 100644 --- a/ambari-web/test/utils/configs/config_initializer_test.js +++ b/ambari-web/test/utils/configs/config_initializer_test.js @@ -263,9 +263,65 @@ describe('App.ConfigInitializer', function () { }, value: ['h0', 'h1'], title: 'array that contains names of hosts with Knox Gateway' - } + }, + 'atlas.rest.address': [ + { + localDB: { + masterComponentHosts: [ + { + component: 'ZOOKEEPER_SERVER', + hostName: 'h0' + }, + { + component: 'ZOOKEEPER_SERVER', + hostName: 'h1' + } + ] + }, + dependencies: { + 'atlas.enableTLS': false, + 'atlas.server.http.port': 21000, + 'atlas.server.https.port': 21443 + }, + value: 'http://h0:21000,http://h1:21000', + title: 'TLS is not enabled' + }, + { + localDB: { + masterComponentHosts: [ + { + component: 'ZOOKEEPER_SERVER', + hostName: 'h0' + }, + { + component: 'ZOOKEEPER_SERVER', + hostName: 'h1' + } + ] + }, + dependencies: { + 'atlas.enableTLS': true, + 'atlas.server.http.port': 21000, + 'atlas.server.https.port': 21443 + }, + value: 'https://h0:21443,https://h1:21443', + title: 'TLS is enabled' + } + ] }; + cases['atlas.rest.address'].forEach(function (test) { + it(test.title, function () { + serviceConfigProperty.setProperties({ + name: 'atlas.rest.address', + value: '' + }); + App.ConfigInitializer.initialValue(serviceConfigProperty, test.localDB, test.dependencies); + expect(serviceConfigProperty.get('value')).to.equal(test.value); + expect(serviceConfigProperty.get('recommendedValue')).to.equal(test.value); + }); + }); + cases['kafka.ganglia.metrics.host'].forEach(function (item) { it(item.message, function () { serviceConfigProperty.setProperties({