ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rle...@apache.org
Subject ambari git commit: AMBARI-11244. Kerberos: display warning that the user must create/distribute principals and keytabs (rlevas)
Date Fri, 22 May 2015 01:02:50 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 2230cc62f -> 12dd68ece


AMBARI-11244. Kerberos: display warning that the user must create/distribute principals and
keytabs (rlevas)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/12dd68ec
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/12dd68ec
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/12dd68ec

Branch: refs/heads/trunk
Commit: 12dd68ecefadec32b0b81b4c7ccfeb77d2f20283
Parents: 2230cc6
Author: Robert Levas <rlevas@hortonworks.com>
Authored: Thu May 21 21:02:39 2015 -0400
Committer: Robert Levas <rlevas@hortonworks.com>
Committed: Thu May 21 21:02:39 2015 -0400

----------------------------------------------------------------------
 .../app/controllers/main/admin/kerberos.js      | 11 +++-
 ambari-web/app/controllers/main/host/details.js | 69 ++++++++++++--------
 ambari-web/app/controllers/main/service/item.js | 10 +--
 .../app/controllers/wizard/step8_controller.js  | 15 +++++
 ambari-web/app/messages.js                      |  6 +-
 .../main/host/details/addComponentPopup.hbs     |  2 +-
 ambari-web/app/templates/wizard/step8.hbs       |  4 ++
 .../test/controllers/main/host/details_test.js  | 11 +++-
 8 files changed, 89 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/12dd68ec/ambari-web/app/controllers/main/admin/kerberos.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos.js b/ambari-web/app/controllers/main/admin/kerberos.js
index 0be41fb..de61da5 100644
--- a/ambari-web/app/controllers/main/admin/kerberos.js
+++ b/ambari-web/app/controllers/main/admin/kerberos.js
@@ -25,7 +25,7 @@ App.MainAdminKerberosController = App.KerberosWizardStep4Controller.extend({
   securityEnabled: false,
   dataIsLoaded: false,
   isRecommendedLoaded: true,
-  kdc_type: 'none',
+  kdc_type: '',
 
   kdcTypesValues: {
     'mit-kdc'         : Em.I18n.t('admin.kerberos.wizard.step1.option.kdc'),
@@ -374,13 +374,14 @@ App.MainAdminKerberosController = App.KerberosWizardStep4Controller.extend({
     }
   },
 
-  getSecurityType: function () {
+  getSecurityType: function (callback) {
     if (this.get('securityEnabled')) {
       App.ajax.send({
         name: 'admin.security.cluster_configs.kerberos',
         sender: this,
         data: {
-          clustName: 'c1'
+          clusterName: App.get('clusterName'),
+          additionalCallback: callback
         },
         success: 'getSecurityTypeSuccess'
       })
@@ -389,6 +390,10 @@ App.MainAdminKerberosController = App.KerberosWizardStep4Controller.extend({
 
   getSecurityTypeSuccess: function (data, opt, params) {
     this.set('kdc_type', data.items && Em.get(data.items[0], 'properties.kdc_type')
? Em.get(data.items[0], 'properties.kdc_type') : 'none' );
+
+    if (Em.typeOf(params.additionalCallback) === 'function') {
+      params.additionalCallback();
+    }
   },
 
   isManualKerberos: function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/12dd68ec/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 4c747fd..034ceae 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -454,7 +454,9 @@ App.MainHostDetailsController = Em.Controller.extend({
   addComponentWithCheck: function (event) {
     var componentName = event.context ? event.context.get('componentName') : "";
     event.hiveMetastoreHost = (componentName == "HIVE_METASTORE" && !!this.get('content.hostName'))
? this.get('content.hostName') : null;
-    App.get('router.mainAdminKerberosController').getKDCSessionState(this.addComponent.bind(this,
event));
+    App.get('router.mainAdminKerberosController').getSecurityType(function (event) {
+      App.get('router.mainAdminKerberosController').getKDCSessionState(this.addComponent.bind(this,
event));
+    }.bind(this, event));
   },
   /**
    * Send command to server to install selected host component
@@ -471,7 +473,10 @@ App.MainHostDetailsController = Em.Controller.extend({
       missedComponents = event.selectedHost ? [] : componentsUtils.checkComponentDependencies(componentName,
{
         scope: 'host',
         installedComponents: this.get('content.hostComponents').mapProperty('componentName')
-      });
+      }),
+      isManualKerberos = App.get('router.mainAdminKerberosController.isManualKerberos'),
+      manualKerberosWarning = isManualKerberos ? Em.I18n.t('hosts.host.manualKerberosWarning')
: '';
+
     if (!!missedComponents.length) {
       var popupMessage = Em.I18n.t('host.host.addComponent.popup.dependedComponents.body').format(component.get('displayName'),
         stringUtils.getFormattedStringFromArray(missedComponents.map(function(cName) {
@@ -484,28 +489,28 @@ App.MainHostDetailsController = Em.Controller.extend({
       case 'ZOOKEEPER_SERVER':
         returnFunc = App.showConfirmationPopup(function () {
           self.primary(component);
-        }, Em.I18n.t('hosts.host.addComponent.' + componentName ));
+        }, Em.I18n.t('hosts.host.addComponent.' + componentName) + manualKerberosWarning);
         break;
       case 'HIVE_METASTORE':
         returnFunc = App.showConfirmationPopup(function () {
           self.set('hiveMetastoreHost', hostName);
           self.loadConfigs("loadHiveConfigs");
-        }, Em.I18n.t('hosts.host.addComponent.' + componentName ));
+        }, Em.I18n.t('hosts.host.addComponent.' + componentName) + manualKerberosWarning);
         break;
       case 'NIMBUS':
         returnFunc = App.showConfirmationPopup(function() {
             self.set('nimbusHost', hostName);
             self.loadConfigs("loadStormConfigs");
-        }, Em.I18n.t('hosts.host.addComponent.' + componentName));
+        }, Em.I18n.t('hosts.host.addComponent.' + componentName) + manualKerberosWarning);
         break;
       case 'RANGER_KMS_SERVER':
         returnFunc = App.showConfirmationPopup(function() {
           self.set('rangerKMSServerHost', hostName);
           self.loadConfigs("loadRangerConfigs");
-        }, Em.I18n.t('hosts.host.addComponent.' + componentName));
+        }, Em.I18n.t('hosts.host.addComponent.' + componentName) + manualKerberosWarning);
         break;
       default:
-        returnFunc = this.addClientComponent(component);
+        returnFunc = this.addClientComponent(component, isManualKerberos);
       }
     return returnFunc;
   },
@@ -513,15 +518,18 @@ App.MainHostDetailsController = Em.Controller.extend({
    * Send command to server to install client on selected host
    * @param component
    */
-  addClientComponent: function (component) {
+  addClientComponent: function (component, isManualKerberos) {
     var self = this;
     var message = this.formatClientsMessage(component);
-    return this.showAddComponentPopup(message, function () {
+
+    return this.showAddComponentPopup(message, isManualKerberos, function () {
       self.primary(component);
     });
   },
 
-  showAddComponentPopup: function (message, primary) {
+  showAddComponentPopup: function (message, isManualKerberos, primary) {
+    isManualKerberos = isManualKerberos || false;
+
     return App.ModalPopup.show({
       primary: Em.I18n.t('hosts.host.addComponent.popup.confirm'),
       header: Em.I18n.t('popup.confirmation.commonHeader'),
@@ -530,6 +538,10 @@ App.MainHostDetailsController = Em.Controller.extend({
         return Em.I18n.t('hosts.host.addComponent.msg').format(message);
       }.property(),
 
+      manualKerberosWarning: function () {
+        return isManualKerberos ? Em.I18n.t('hosts.host.manualKerberosWarning') : '';
+      }.property(),
+
       bodyClass: Em.View.extend({
         templateName: require('templates/main/host/details/addComponentPopup')
       }),
@@ -2156,24 +2168,27 @@ App.MainHostDetailsController = Em.Controller.extend({
         })));
       App.showAlertPopup(Em.I18n.t('host.host.addComponent.popup.dependedComponents.header'),
popupMessage);
     } else {
-      App.get('router.mainAdminKerberosController').getKDCSessionState(function () {
-        var sendInstallCommand = function () {
-          if (clientsToInstall.length) {
-            self.sendComponentCommand(clientsToInstall, Em.I18n.t('host.host.details.installClients'),
'INSTALLED');
-          }
-        };
-        if (clientsToAdd.length) {
-          var message = stringUtils.getFormattedStringFromArray(clientsToAdd.mapProperty('displayName'));
-          self.showAddComponentPopup(message, function () {
+      App.get('router.mainAdminKerberosController').getSecurityType(function () {
+        App.get('router.mainAdminKerberosController').getKDCSessionState(function () {
+          var sendInstallCommand = function () {
+            if (clientsToInstall.length) {
+              self.sendComponentCommand(clientsToInstall, Em.I18n.t('host.host.details.installClients'),
'INSTALLED');
+            }
+          };
+          if (clientsToAdd.length) {
+            var message = stringUtils.getFormattedStringFromArray(clientsToAdd.mapProperty('displayName'));
+            var isManualKerberos = App.get('router.mainAdminKerberosController.isManualKerberos');
+            self.showAddComponentPopup(message, isManualKerberos, function () {
+              sendInstallCommand();
+              clientsToAdd.forEach(function (component) {
+                this.primary(component);
+              }, self);
+            });
+          } else {
             sendInstallCommand();
-            clientsToAdd.forEach(function (component) {
-              this.primary(component);
-            }, self);
-          });
-        } else {
-          sendInstallCommand();
-        }
-      });
+          }
+        });
+      }.bind(this));
     }
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/12dd68ec/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index ad33b98..3312457 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -166,10 +166,10 @@ App.MainServiceItemController = Em.Controller.extend({
     var self = this;
     var serviceDisplayName = this.get('content.displayName');
     var isMaintenanceOFF = this.get('content.passiveState') === 'OFF';
-    
+
     var msg = isMaintenanceOFF && serviceHealth == 'INSTALLED'? Em.I18n.t('services.service.stop.warningMsg.turnOnMM').format(serviceDisplayName)
: null;
     msg = self.addAdditionalWarningMessage(serviceHealth, msg, serviceDisplayName);
-    
+
     var bodyMessage = Em.Object.create({
       putInMaintenance: (serviceHealth == 'INSTALLED' && isMaintenanceOFF) || (serviceHealth
== 'STARTED' && !isMaintenanceOFF),
       turnOnMmMsg: serviceHealth == 'INSTALLED' ? Em.I18n.t('passiveState.turnOnFor').format(serviceDisplayName)
: Em.I18n.t('passiveState.turnOffFor').format(serviceDisplayName),
@@ -187,7 +187,7 @@ App.MainServiceItemController = Em.Controller.extend({
   addAdditionalWarningMessage: function(serviceHealth, msg, serviceDisplayName){
     var servicesAffectedDisplayNames = [];
     var servicesAffected = [];
-    
+
     if(serviceHealth == 'INSTALLED'){
       //To stop a service, display dependencies message...
       var currentService = this.get('content.serviceName');
@@ -214,7 +214,7 @@ App.MainServiceItemController = Em.Controller.extend({
           }
         }
       },this);
-      
+
       var names = servicesAffectedDisplayNames.join();
       if(names){
         //only display this line with a non-empty dependency list
@@ -225,7 +225,7 @@ App.MainServiceItemController = Em.Controller.extend({
           msg = dependenciesMsg;
       }
     }
-    
+
     return msg;
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/12dd68ec/ambari-web/app/controllers/wizard/step8_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js
index 0e1b777..067e089 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -69,6 +69,14 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs,
App.wiz
   configs: [],
 
   /**
+   * True if Kerberos is installed on the cluster and the kdc_type on the server is set to
"none"
+   * @type {Boolean}
+   */
+  isManualKerberos: function () {
+    return App.get('router.mainAdminKerberosController.kdc_type') === 'none';
+  }.property('App.router.mainAdminKerberosController.kdc_type'),
+
+  /**
    * All configs
    * @type {Array}
    */
@@ -127,6 +135,12 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs,
App.wiz
     return App.router.get('mainAdminKerberosController.securityEnabled');
   }.property('App.router.mainAdminKerberosController.securityEnabled'),
 
+  getSecurityType: function () {
+    if (this.get('securityEnabled')) {
+      App.router.mainAdminKerberosController.getSecurityType();
+    }
+  },
+
   /**
    * Selected config group
    * @type {Object}
@@ -221,6 +235,7 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs,
App.wiz
     this.loadServices();
     this.set('isSubmitDisabled', false);
     this.set('isBackBtnDisabled', false);
+    this.getSecurityType();
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/12dd68ec/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index d0f680f..15e275a 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -771,8 +771,9 @@ Em.I18n.translations = {
   'installer.step7.misc.notification.use_ssl':'Use SSL',
 
 
-  'installer.step8.header':'Review',
-  'installer.step8.body':'Please review the configuration before installation',
+  'installer.step8.header': 'Review',
+  'installer.step8.body': 'Please review the configuration before installation',
+  'installer.step8.kerberors.warning': '<strong>Because Kerberos has been manually
installed on the cluster, you will have to create/distribute principals and keytabs when this
operation is finished.</strong>',
   'installer.step8.deployPopup.message':'Preparing to Deploy: {0} of {1} tasks completed.',
   'installer.step8.hosts':' hosts',
   'installer.step8.host':' host',
@@ -2185,6 +2186,7 @@ Em.I18n.translations = {
   'hosts.host.zooKeeper.configs.save.note': 'This configuration is created by ambari while
installing/deleting zookeeper component on a host',
   '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.',
   'hosts.host.addComponent.popup.confirm':'Confirm Add',
+  'hosts.host.manualKerberosWarning': '<br/><strong>Because Kerberos has been
manually installed on the cluster, you will have to create/distribute principals and keytabs
when this operation is finished.</strong>',
   'hosts.host.deleteComponent.popup.deleteNimbus':'Deleting <i>Storm Nimbus</i>
will reconfigure <b>nimbus.seeds</b>, <b>topology.min.replication.count</b>,
<b>topology.max.replication.wait.time.sec</b> properties if they are defined.',
   'hosts.host.storm.configs.save.note': 'This configuration is created by ambari while installing/deleting
storm component on a host',
   'hosts.host.datanode.decommission':'Decommission DataNode',

http://git-wip-us.apache.org/repos/asf/ambari/blob/12dd68ec/ambari-web/app/templates/main/host/details/addComponentPopup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host/details/addComponentPopup.hbs b/ambari-web/app/templates/main/host/details/addComponentPopup.hbs
index a65f0e6..ff69b9e 100644
--- a/ambari-web/app/templates/main/host/details/addComponentPopup.hbs
+++ b/ambari-web/app/templates/main/host/details/addComponentPopup.hbs
@@ -16,4 +16,4 @@
 * limitations under the License.
 }}
 
-{{addComponentMsg}}<br /><br />
\ No newline at end of file
+{{addComponentMsg}}<br />{{{manualKerberosWarning}}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/12dd68ec/ambari-web/app/templates/wizard/step8.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/wizard/step8.hbs b/ambari-web/app/templates/wizard/step8.hbs
index 8506371..ec4bac7 100644
--- a/ambari-web/app/templates/wizard/step8.hbs
+++ b/ambari-web/app/templates/wizard/step8.hbs
@@ -20,6 +20,10 @@
 
   <div class="alert alert-info">
     {{t installer.step8.body}}
+    {{#if controller.isManualKerberos}}
+      <br/><br/>
+      {{t installer.step8.kerberors.warning}}
+    {{/if}}
   </div>
 
   <div id="step8-content" class="well pre-scrollable">

http://git-wip-us.apache.org/repos/asf/ambari/blob/12dd68ec/ambari-web/test/controllers/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js
index f0df0f2..30f1d01 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -531,7 +531,7 @@ describe('App.MainHostDetailsController', function () {
     });
 
     it('should display add component confirmation', function () {
-      var popup = controller.showAddComponentPopup(message, function () {
+      var popup = controller.showAddComponentPopup(message, false, function () {
         controller.primary(component);
       });
       expect(App.ModalPopup.show.calledOnce).to.be.true;
@@ -2191,6 +2191,7 @@ describe('App.MainHostDetailsController', function () {
             c1: [],
             c2: []
           },
+          getSecurityTypeCalled: null, //should have same value as getKDCSessionStateCalled,
always
           getKDCSessionStateCalled: true,
           sendComponentCommandCalled: true,
           showAlertPopupCalled: false,
@@ -2206,6 +2207,7 @@ describe('App.MainHostDetailsController', function () {
           dependencies: {
             c3: []
           },
+          getSecurityTypeCalled: null, //should have same value as getKDCSessionStateCalled,
always
           getKDCSessionStateCalled: true,
           sendComponentCommandCalled: false,
           showAlertPopupCalled: false,
@@ -2221,6 +2223,7 @@ describe('App.MainHostDetailsController', function () {
           dependencies: {
             c4: ['c5']
           },
+          getSecurityTypeCalled: null, //should have same value as getKDCSessionStateCalled,
always
           getKDCSessionStateCalled: false,
           sendComponentCommandCalled: false,
           showAlertPopupCalled: true,
@@ -2241,6 +2244,7 @@ describe('App.MainHostDetailsController', function () {
             c5: ['c6'],
             c6: ['c5']
           },
+          getSecurityTypeCalled: null, //should have same value as getKDCSessionStateCalled,
always
           getKDCSessionStateCalled: true,
           sendComponentCommandCalled: false,
           showAlertPopupCalled: false,
@@ -2255,6 +2259,9 @@ describe('App.MainHostDetailsController', function () {
       sinon.stub(App.get('router.mainAdminKerberosController'), 'getKDCSessionState', function
(arg) {
         return arg();
       });
+      sinon.stub(App.get('router.mainAdminKerberosController'), 'getSecurityType', function
(arg) {
+        return arg();
+      });
       sinon.stub(App, 'showAlertPopup', Em.K);
       sinon.stub(App.StackServiceComponent, 'find', function (componentName) {
         return Em.Object.create({
@@ -2267,6 +2274,7 @@ describe('App.MainHostDetailsController', function () {
       controller.sendComponentCommand.restore();
       controller.showAddComponentPopup.restore();
       App.get('router.mainAdminKerberosController').getKDCSessionState.restore();
+      App.get('router.mainAdminKerberosController').getSecurityType.restore();
       App.showAlertPopup.restore();
       App.StackServiceComponent.find.restore();
       componentsUtils.checkComponentDependencies.restore();
@@ -2280,6 +2288,7 @@ describe('App.MainHostDetailsController', function () {
         controller.installClients({
           context: item.context
         });
+        expect(App.get('router.mainAdminKerberosController').getSecurityType.calledOnce).to.equal(item.getKDCSessionStateCalled);
         expect(App.get('router.mainAdminKerberosController').getKDCSessionState.calledOnce).to.equal(item.getKDCSessionStateCalled);
         expect(controller.sendComponentCommand.calledOnce).to.equal(item.sendComponentCommandCalled);
         expect(App.showAlertPopup.calledOnce).to.equal(item.showAlertPopupCalled);


Mime
View raw message