You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2017/02/17 22:06:36 UTC
[37/50] [abbrv] ambari git commit: AMBARI-20059 Storm config change
results in Consistency check failed (dbuzhor)
AMBARI-20059 Storm config change results in Consistency check failed (dbuzhor)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/984b35e9
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/984b35e9
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/984b35e9
Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 984b35e9c1f3121f6688dc797e93b710db69d6b5
Parents: ce404d6
Author: Denys Buzhor <bd...@hortonworks.com>
Authored: Fri Feb 17 00:48:26 2017 +0200
Committer: Denys Buzhor <bd...@hortonworks.com>
Committed: Fri Feb 17 10:20:25 2017 +0200
----------------------------------------------------------------------
.../controllers/main/service/info/configs.js | 35 +++++++++++++--
.../app/mixins/common/track_request_mixin.js | 5 +++
.../main/service/info/config_test.js | 45 ++++++++++++++++++++
3 files changed, 81 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/984b35e9/ambari-web/app/controllers/main/service/info/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js
index d95a2d2..786c6f9 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -278,6 +278,36 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.AddSecurityConfi
isInit: true,
/**
+ * Returns dependencies at all levels for service including dependencies for its childs, children dependencies
+ * and so on.
+ *
+ * @param {String} serviceName name of services to get dependencies
+ * @returns {String[]}
+ */
+ getServicesDependencies: function(serviceName) {
+ var dependencies = Em.getWithDefault(App.StackService.find(serviceName), 'dependentServiceNames', []);
+ var loop = function(dependentServices, allDependencies) {
+ return dependentServices.reduce(function(all, name) {
+ var service = App.StackService.find(name);
+ if (!service) {
+ return all;
+ }
+ var serviceDependencies = service.get('dependentServiceNames');
+ if (!serviceDependencies.length) {
+ return all.concat(name);
+ }
+ var missed = _.intersection(_.difference(serviceDependencies, all), serviceDependencies);
+ if (missed.length) {
+ return loop(missed, all.concat(missed));
+ }
+ return all;
+ }, allDependencies || dependentServices);
+ };
+
+ return loop(dependencies).uniq().without(serviceName).toArray();
+ },
+
+ /**
* On load function
* @method loadStep
*/
@@ -285,10 +315,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.AddSecurityConfi
var serviceName = this.get('content.serviceName'), self = this;
App.router.get('mainController').stopPolling();
this.clearStep();
- this.set('dependentServiceNames', (App.StackService.find(serviceName).get('dependentServiceNames') || []).reduce(function(acc, i) {
- acc.push(i);
- return Array.prototype.concat.apply(acc, App.StackService.find(i).get('dependentServiceNames').toArray()).without(serviceName).uniq();
- }, []));
+ this.set('dependentServiceNames', this.getServicesDependencies(serviceName));
this.trackRequestChain(this.loadConfigTheme(serviceName).always(function () {
if (self.get('preSelectedConfigVersion')) {
self.loadPreSelectedConfigVersion();
http://git-wip-us.apache.org/repos/asf/ambari/blob/984b35e9/ambari-web/app/mixins/common/track_request_mixin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/track_request_mixin.js b/ambari-web/app/mixins/common/track_request_mixin.js
index 4efcecb..c665253 100644
--- a/ambari-web/app/mixins/common/track_request_mixin.js
+++ b/ambari-web/app/mixins/common/track_request_mixin.js
@@ -22,6 +22,11 @@ App.TrackRequestMixin = Em.Mixin.create({
requestsInProgress: [],
+ init: function() {
+ this.set('requestsInProgress', []);
+ this._super([].slice.call(arguments));
+ },
+
/**
* register request to view to track his progress
* @param {$.ajax} request
http://git-wip-us.apache.org/repos/asf/ambari/blob/984b35e9/ambari-web/test/controllers/main/service/info/config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/info/config_test.js b/ambari-web/test/controllers/main/service/info/config_test.js
index 4cc2ef8..9d925be 100644
--- a/ambari-web/test/controllers/main/service/info/config_test.js
+++ b/ambari-web/test/controllers/main/service/info/config_test.js
@@ -1052,4 +1052,49 @@ describe("App.MainServiceInfoConfigsController", function () {
});
+ describe('#getServicesDependencies', function() {
+ var createService = function(serviceName, dependencies) {
+ return Em.Object.create({
+ serviceName: serviceName,
+ dependentServiceNames: dependencies || []
+ });
+ };
+ var stackServices = [
+ createService('STORM', ['RANGER', 'ATLAS', 'ZOOKEEPER']),
+ createService('RANGER', ['HIVE', 'HDFS']),
+ createService('HIVE', ['YARN']),
+ createService('ZOOKEEPER', ['HDFS']),
+ createService('ATLAS'),
+ createService('HDFS', ['ZOOKEEPER']),
+ createService('YARN', ['HIVE'])
+ ];
+ beforeEach(function() {
+ sinon.stub(App.StackService, 'find', function(serviceName) {
+ return stackServices.findProperty('serviceName', serviceName);
+ });
+ });
+ afterEach(function() {
+ App.StackService.find.restore();
+ });
+
+ it('should returns all service dependencies STORM service', function() {
+ var result = mainServiceInfoConfigsController.getServicesDependencies('STORM');
+ expect(result).to.be.eql(['RANGER', 'ATLAS', 'ZOOKEEPER', 'HIVE', 'HDFS', 'YARN']);
+ });
+
+ it('should returns all service dependencies for ATLAS', function() {
+ var result = mainServiceInfoConfigsController.getServicesDependencies('ATLAS');
+ expect(result).to.be.eql([]);
+ });
+
+ it('should returns all service dependencies for RANGER', function() {
+ var result = mainServiceInfoConfigsController.getServicesDependencies('RANGER');
+ expect(result).to.be.eql(['HIVE', 'HDFS', 'YARN', 'ZOOKEEPER']);
+ });
+
+ it('should returns all service dependencies for YARN', function() {
+ var result = mainServiceInfoConfigsController.getServicesDependencies('YARN');
+ expect(result).to.be.eql(['HIVE']);
+ });
+ });
});