You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by am...@apache.org on 2018/01/05 07:56:26 UTC

[30/45] ambari git commit: AMBARI-22699. Update FE to initiate regenerate keytab file operations for a service and a host (alexantonenko)

AMBARI-22699. Update FE to initiate regenerate keytab file operations for a service and a host (alexantonenko)


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

Branch: refs/heads/branch-feature-AMBARI-22008-isilon
Commit: c088e59ebcf099b01603d883dce7700d44cabc68
Parents: 217620b
Author: Alex Antonenko <aa...@hortonworks.com>
Authored: Thu Jan 4 19:04:40 2018 +0300
Committer: Alex Antonenko <aa...@hortonworks.com>
Committed: Thu Jan 4 19:04:40 2018 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host/details.js | 32 +++++++++++++++++++-
 ambari-web/app/controllers/main/service/item.js | 25 +++++++++++++++
 ambari-web/app/messages.js                      |  4 +++
 ambari-web/app/models/host_component.js         |  6 ++++
 ambari-web/app/utils/ajax/ajax.js               | 30 ++++++++++++++++++
 ambari-web/app/views/main/host/details.js       |  4 +++
 ambari-web/app/views/main/service/item.js       |  4 +++
 ambari-web/test/utils/date/timezone_test.js     |  2 +-
 8 files changed, 105 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c088e59e/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 20a72bf..e52eec0 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -2305,6 +2305,9 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
       case "checkHost":
         this.runHostCheckConfirmation();
         break;
+      case "regenerateKeytabFileOperations":
+        this.regenerateKeytabFileOperations();
+        break;
     }
   },
 
@@ -3241,6 +3244,33 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
         }
       });
     }
-  }
+  },
+
+
+  regenerateKeytabFileOperations: function () {
+    var self = this;
+    var hostName = this.content.get('hostName');
+    var clusterName = App.get('clusterName');
+    return App.showConfirmationPopup(function() {
+      return App.ajax.send({
+        name: "admin.kerberos_security.regenerate_keytabs.host",
+        sender: self,
+        data: {
+          clusterName: clusterName,
+          hostName: hostName
+        },
+        success: 'regenerateKeytabFileOperationsRequestSuccess',
+        error: 'regenerateKeytabFileOperationsRequestError'
+      });
+    }, Em.I18n.t('question.sure.regenerateKeytab.host').format(hostName));
+  },
+
+  regenerateKeytabFileOperationsRequestSuccess: function(){
+    App.router.get('backgroundOperationsController').showPopup();
+  },
+
+  regenerateKeytabFileOperationsRequestError: function () {
+    App.showAlertPopup(Em.I18n.t('common.error'), Em.I18n.t('alerts.notifications.regenerateKeytab.host.error').format(this.content.get('hostName')));
+  },
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/c088e59e/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 f8a6e62..690869b 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -780,6 +780,31 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
     App.showAlertPopup(Em.I18n.t('services.service.actions.run.rebalanceHdfsNodes.error'), error);
   },
 
+  regenerateKeytabFileOperations: function () {
+    var self = this;
+    var serviceName = this.content.get('serviceName');
+    var clusterName = App.get('clusterName');
+    return App.showConfirmationPopup(function() {
+      return App.ajax.send({
+        name: "admin.kerberos_security.regenerate_keytabs.service",
+        sender: self,
+        data: {
+          clusterName: clusterName,
+          serviceName: serviceName
+        },
+        success: 'regenerateKeytabFileOperationsRequestSuccess',
+        error: 'regenerateKeytabFileOperationsRequestError'
+      });
+    }, Em.I18n.t('question.sure.regenerateKeytab.service').format(serviceName));
+  },
+
+  regenerateKeytabFileOperationsRequestSuccess: function(){
+    App.router.get('backgroundOperationsController').showPopup();
+  },
+
+  regenerateKeytabFileOperationsRequestError: function () {
+    App.showAlertPopup(Em.I18n.t('common.error'), Em.I18n.t('alerts.notifications.regenerateKeytab.service.error').format(this.content.get('serviceName')));
+  },
   /**
    * On click callback for <code>run compaction</code> button
    * @param event

http://git-wip-us.apache.org/repos/asf/ambari/blob/c088e59e/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 6da0368..bfd4264 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -439,6 +439,8 @@ Em.I18n.translations = {
   'question.sure.startAll':'Are you sure you want to start all the components?',
   'question.sure.stopAll':'Are you sure you want to stop all the components?',
   'question.sure.restartAll':'Are you sure you want to restart all the components?',
+  'question.sure.regenerateKeytab.service': 'Are you sure you want to regenerate keytab file operations for a {0} service?',
+  'question.sure.regenerateKeytab.host': 'Are you sure you want to regenerate keytab file operations for a {0} host?',
 
   'popup.highlight':'click to highlight',
   'popup.confirmation.commonHeader':'Confirmation',
@@ -1189,6 +1191,8 @@ Em.I18n.translations = {
   'alerts.notifications.addCustomPropertyPopup.header': 'Add Property',
   'alerts.notifications.addCustomPropertyPopup.error.propertyExists': 'Custom Property with current name already exists',
   'alerts.notifications.addCustomPropertyPopup.error.invalidPropertyName': 'Property name can only contain letters, numbers or . -_* characters',
+  'alerts.notifications.regenerateKeytab.service.error' : 'Keytabs for {0} service could not be regenerated',
+  'alerts.notifications.regenerateKeytab.host.error' : 'Keytabs for {0} host could not be regenerated',
 
 
   'wizard.progressPage.notice.completed':'Please proceed to the next step.',

http://git-wip-us.apache.org/repos/asf/ambari/blob/c088e59e/ambari-web/app/models/host_component.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/host_component.js b/ambari-web/app/models/host_component.js
index cdcf991..19eb085 100644
--- a/ambari-web/app/models/host_component.js
+++ b/ambari-web/app/models/host_component.js
@@ -311,6 +311,12 @@ App.HostComponentActionMap = {
         cssClass: 'glyphicon glyphicon-refresh',
         disabled: false
       },
+      REGENERATE_KEYTAB_FILE_OPERATIONS: {
+        action: 'regenerateKeytabFileOperations',
+        label: Em.I18n.t('admin.kerberos.button.regenerateKeytabs'),
+        cssClass: 'glyphicon glyphicon-repeat',
+        isHidden: !App.get('isKerberosEnabled')
+      },
       REFRESHQUEUES: {
         action: 'refreshYarnQueues',
         customCommand: 'REFRESHQUEUES',

http://git-wip-us.apache.org/repos/asf/ambari/blob/c088e59e/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index 483be5e..10e62d1 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -1911,6 +1911,36 @@ var urls = {
     }
   },
 
+  'admin.kerberos_security.regenerate_keytabs.service' : {
+    'real': '/clusters/{clusterName}?regenerate_keytabs=all&regenerate_components={serviceName}',
+    'mock': '',
+    'type': 'PUT',
+    'format': function (data) {
+      return {
+        data: JSON.stringify({
+          "Clusters" : {
+            "security_type" : "KERBEROS"
+          }
+        })
+      }
+    }
+  },
+
+  'admin.kerberos_security.regenerate_keytabs.host' : {
+    'real': '/clusters/{clusterName}?regenerate_keytabs=all&regenerate_hosts={hostName}',
+    'mock': '',
+    'type': 'PUT',
+    'format': function (data) {
+      return {
+        data: JSON.stringify({
+          "Clusters" : {
+            "security_type" : "KERBEROS"
+          }
+        })
+      }
+    }
+  },
+
   'wizard.step1.post_version_definition_file.xml': {
     'real': '/version_definitions?dry_run=true',
     'mock': '',

http://git-wip-us.apache.org/repos/asf/ambari/blob/c088e59e/ambari-web/app/views/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/details.js b/ambari-web/app/views/main/host/details.js
index 54e3a76..2cf4f42 100644
--- a/ambari-web/app/views/main/host/details.js
+++ b/ambari-web/app/views/main/host/details.js
@@ -80,6 +80,10 @@ App.MainHostDetailsView = Em.View.extend({
         label: this.t('passiveState.turn' + onOff)
       });
     }
+    if (App.get('isKerberosEnabled')){
+      var actionMap = App.HostComponentActionMap.getMap(this);
+      result.push(actionMap.REGENERATE_KEYTAB_FILE_OPERATIONS);
+    }    
     if (App.isAuthorized("HOST.ADD_DELETE_HOSTS")) {
       result.push({
         action: 'deleteHost',

http://git-wip-us.apache.org/repos/asf/ambari/blob/c088e59e/ambari-web/app/views/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/item.js b/ambari-web/app/views/main/service/item.js
index 945dc8f..72e5e39 100644
--- a/ambari-web/app/views/main/service/item.js
+++ b/ambari-web/app/views/main/service/item.js
@@ -259,6 +259,10 @@ App.MainServiceItemView = Em.View.extend({
        });
       }
 
+      if (App.get('isKerberosEnabled')){
+        options.push(actionMap.REGENERATE_KEYTAB_FILE_OPERATIONS);
+      }
+
       allMasters.forEach(function(master) {
         var component = App.StackServiceComponent.find(master);
         var commands = component.get('customCommands');

http://git-wip-us.apache.org/repos/asf/ambari/blob/c088e59e/ambari-web/test/utils/date/timezone_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/date/timezone_test.js b/ambari-web/test/utils/date/timezone_test.js
index 37a8c8c..ebf5e68 100644
--- a/ambari-web/test/utils/date/timezone_test.js
+++ b/ambari-web/test/utils/date/timezone_test.js
@@ -139,7 +139,7 @@ describe('timezoneUtils', function () {
     it('Detect UTC+1', function () {
       mockTimezoneOffset(0, 60);
       var tz = timezoneUtils.detectUserTimezone();
-      expect(tz).to.contain('0-60|Atlantic');
+      expect(tz).to.contain('0-60|Africa');
     });
 
     it('Detect UTC+1 for Europe', function () {