You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2014/09/26 17:30:19 UTC
git commit: AMBARI-7521 Adding a component to a host should check for
the presence of host scope dependencies of that component. (Buzhor Denys via
atkach)
Repository: ambari
Updated Branches:
refs/heads/trunk 353daeb94 -> e7ce4bb6f
AMBARI-7521 Adding a component to a host should check for the presence of host scope dependencies of that component. (Buzhor Denys via atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e7ce4bb6
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e7ce4bb6
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e7ce4bb6
Branch: refs/heads/trunk
Commit: e7ce4bb6fd7b287051214ffeb4c9828b6ee43e94
Parents: 353daeb
Author: atkach <at...@hortonworks.com>
Authored: Fri Sep 26 18:27:05 2014 +0300
Committer: atkach <at...@hortonworks.com>
Committed: Fri Sep 26 18:27:05 2014 +0300
----------------------------------------------------------------------
ambari-web/app/controllers/main/host/details.js | 10 +++++++++-
ambari-web/app/messages.js | 2 ++
ambari-web/app/utils/components.js | 12 ++++++++++++
3 files changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/e7ce4bb6/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index 11e5d04..5a698da 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -19,6 +19,7 @@
var App = require('app');
var batchUtils = require('utils/batch_scheduled_requests');
var componentsUtils = require('utils/components');
+var stringUtils = require('utils/string_utils');
App.MainHostDetailsController = Em.Controller.extend({
@@ -392,7 +393,14 @@ App.MainHostDetailsController = Em.Controller.extend({
var self = this;
var component = event.context;
var componentName = component.get('componentName');
-
+ var missedComponents = componentsUtils.checkComponentDependencies(componentName, this.get('content.hostComponents').mapProperty('componentName'))
+ if (!!missedComponents.length) {
+ var popupMessage = Em.I18n.t('host.host.addComponent.popup.dependedComponents.body').format(component.get('displayName'),
+ stringUtils.getFormattedStringFromArray(missedComponents.map(function(cName) {
+ return App.StackServiceComponent.find(cName).get('displayName');
+ })));
+ return App.showAlertPopup(Em.I18n.t('host.host.addComponent.popup.dependedComponents.header'), popupMessage);
+ }
if (componentName === 'ZOOKEEPER_SERVER') {
return App.showConfirmationPopup(function () {
self.primary(component);
http://git-wip-us.apache.org/repos/asf/ambari/blob/e7ce4bb6/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 2dd6225..c8e94a9 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1709,6 +1709,8 @@ Em.I18n.translations = {
'hosts.host.addComponent.msg':'Are you sure you want to add {0}?',
'hosts.host.addComponent.addZooKeeper':'Adding ZooKeeper Server may reconfigure such properties:<ul><li>ha.zookeeper.quorum</li><li>hbase.zookeeper.quorum</li><li>templeton.zookeeper.hosts</li><li>yarn.resourcemanager.zk-address</li><li>hive.zookeeper.quorum</li></ul>',
'hosts.host.addComponent.deleteHostWithZooKeeper':'Deleting host with ZooKeeper Server may reconfigure such properties:<ul><li>ha.zookeeper.quorum</li><li>hbase.zookeeper.quorum</li><li>templeton.zookeeper.hosts</li><li>yarn.resourcemanager.zk-address</li><li>hive.zookeeper.quorum</li></ul>',
+ 'host.host.addComponent.popup.dependedComponents.body': '{0} requires {1} to be installed along with it. Please add them first and then try adding {0}',
+ 'host.host.addComponent.popup.dependedComponents.header': 'Component dependencies',
'hosts.host.zooKeeper.configs.save.note': 'This configuration is created by ambari while installing/deleting zookeeper component on a host',
'hosts.host.addComponent.note':'<b>Important:</b> After this <i>{0}</i> is installed, go to <i>Services -> Nagios</i> to restart the Nagios service. This is required for the alerts and notifications to work properly.',
'hosts.host.addComponent.securityNote':'You are running your cluster in secure mode. You must set up the keytab for {0} on {1} before you proceed. Otherwise, the component will not be able to start properly.',
http://git-wip-us.apache.org/repos/asf/ambari/blob/e7ce4bb6/ambari-web/app/utils/components.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/components.js b/ambari-web/app/utils/components.js
index a7fadec..63c5348 100644
--- a/ambari-web/app/utils/components.js
+++ b/ambari-web/app/utils/components.js
@@ -134,6 +134,18 @@ module.exports = {
var newWindow = window.open(url);
newWindow.focus();
}
+ },
+ /**
+ * Check if all required components are installed on host.
+ *
+ * @param {String} componentName
+ * @param {Array} installedComponentNames
+ * @return {Array} - names of missed components
+ */
+ checkComponentDependencies: function(componentName, installedComponentNames) {
+ return App.StackServiceComponent.find(componentName).get('dependencies').filter(function(dependency) {
+ return !installedComponentNames.contains(dependency)
+ });
}
};
\ No newline at end of file