Browse Source

AMBARI-11360. Kerberos FE: during disable, need option skip if unable to access KDC to remove principals. (rlevas via yusaku)

Yusaku Sako 10 years ago
parent
commit
a285987dde

+ 9 - 0
ambari-web/app/controllers/main/admin/kerberos/disable_controller.js

@@ -41,6 +41,15 @@ App.KerberosDisableController = App.KerberosProgressPageController.extend(App.Wi
       name: 'admin.unkerberize.cluster',
       sender: this,
       success: 'startPolling',
+      error: 'onTaskErrorWithSkip'
+    });
+  },
+
+  skipTask: function () {
+    return App.ajax.send({
+      name: 'admin.unkerberize.cluster.skip',
+      sender: this,
+      success: 'startPolling',
       error: 'onTaskError'
     });
   },

+ 18 - 4
ambari-web/app/mixins/wizard/wizardProgressPageController.js

@@ -277,6 +277,10 @@ App.wizardProgressPageControllerMixin = Em.Mixin.create({
     this.get('tasks').findProperty('id', taskId).set('status', status);
   },
 
+  setTaskCanSkip: function (taskId, canSkip) {
+    this.get('tasks').findProperty('id', taskId).set('canSkip', true);
+  },
+
   setRequestIds: function (taskId, requestIds) {
     this.get('tasks').findProperty('id', taskId).set('requestIds', requestIds);
   },
@@ -336,12 +340,19 @@ App.wizardProgressPageControllerMixin = Em.Mixin.create({
       } else {
         this.set('showRetry', true);
       }
+
+      if (this.get('tasks').someProperty('canSkip', true)) {
+        this.get('tasks').findProperty('canSkip', true).set('showSkip', true);
+      }
+
       if (App.supports.autoRollbackHA) {
         this.get('tasks').findProperty('status', 'FAILED').set('showRollback', true);
       }
     }
     this.get('tasks').filterProperty('status', 'COMPLETED').setEach('showRetry', false);
     this.get('tasks').filterProperty('status', 'COMPLETED').setEach('showRollback', false);
+    this.get('tasks').filterProperty('status', 'COMPLETED').setEach('showSkip', false);
+    this.get('tasks').filterProperty('status', 'IN_PROGRESS').setEach('showSkip', false);
 
     if (data && data.deferred) {
       data.deferred.resolve();
@@ -359,6 +370,11 @@ App.wizardProgressPageControllerMixin = Em.Mixin.create({
     this.setTaskStatus(this.get('currentTaskId'), 'FAILED');
   },
 
+  onTaskErrorWithSkip: function () {
+    this.onTaskError();
+    this.setTaskCanSkip(this.get('currentTaskId'), true);
+  },
+
   onSingleRequestError: function (jqXHR, ajaxOptions, error, opt) {
     App.ajax.defaultErrorHandler(jqXHR, opt.url, opt.method, jqXHR.status);
     this.set('status', 'FAILED');
@@ -512,7 +528,7 @@ App.wizardProgressPageControllerMixin = Em.Mixin.create({
           },
           success: 'onCreateComponent',
           error: 'onCreateComponent'
-        });        
+        });
       } else {
         self.onCreateComponent(null, null, {
           hostName: result.mapProperty('hostName'),
@@ -542,7 +558,7 @@ App.wizardProgressPageControllerMixin = Em.Mixin.create({
 
   /**
    * Update component status on selected hosts.
-   * 
+   *
    * @param {string} componentName
    * @param {(string|string[])} hostName
    * @param {string} serviceName
@@ -660,5 +676,3 @@ App.wizardProgressPageControllerMixin = Em.Mixin.create({
   }
 
 });
-
-

+ 16 - 0
ambari-web/app/utils/ajax/ajax.js

@@ -1422,6 +1422,22 @@ var urls = {
       }
     }
   },
+
+  'admin.unkerberize.cluster.skip': {
+    'type': 'PUT',
+    'real': '/clusters/{clusterName}?manage_kerberos_identities=false',
+    'mock': '',
+    'format': function (data) {
+      return {
+        data: JSON.stringify({
+          Clusters: {
+            security_type: "NONE"
+          }
+        })
+      }
+    }
+  },
+
   'get.cluster.artifact': {
     'real': '/clusters/{clusterName}/artifacts/{artifactName}?fields=artifact_data',
     'mock': '/data/wizard/kerberos/stack_descriptors.json'