Procházet zdrojové kódy

AMBARI-8652. Kerberos wizard->Configure kerberos page: Expose admin credentials on ui and put them as cluster session attributes. (jaimin)

Jaimin Jetly před 10 roky
rodič
revize
54d01fc542

+ 0 - 26
ambari-server/src/main/resources/stacks/HDP/2.2/services/KERBEROS/configuration/krb5-conf.xml

@@ -114,32 +114,6 @@
     </description>
     <value/>
   </property>
-  <property>
-    <name>test_principal</name>
-    <description>
-      The principal that may be used to test the Kerberos configuration (this will not be retained)
-    </description>
-    <value/>
-  </property>
-  <property>
-    <name>test_password</name>
-    <description>
-      The password for the administrative principal (either this value or the keytab value is
-      required to be set, neither is expected to be retained)
-    </description>
-    <value/>
-    <property-type>PASSWORD</property-type>
-  </property>
-  <property>
-    <name>test_keytab</name>
-    <description>
-      The base64-encoded keytab for the test principal (either this value or the password
-      value is required to be set, neither is expected to be retained)
-    </description>
-    <value>
-
-    </value>
-  </property>
 
 
   <property>

+ 0 - 44
ambari-web/app/assets/data/wizard/stack/hdp/version2.0.1/KERBEROS.json

@@ -323,50 +323,6 @@
         "stack_version" : "2.2",
         "type" : "krb5-conf.xml"
       }
-    },
-    {
-      "href" : "http://c6403.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/services/KERBEROS/configurations/test_keytab",
-      "StackConfigurations" : {
-        "final" : "false",
-        "property_description" : "\n      The base64-encoded keytab for the test principal (either this value or the password\n      value is required to be set, neither is expected to be retained)\n    ",
-        "property_name" : "test_keytab",
-        "property_type" : [ ],
-        "property_value" : "\n\n    ",
-        "service_name" : "KERBEROS",
-        "stack_name" : "HDP",
-        "stack_version" : "2.2",
-        "type" : "krb5-conf.xml"
-      }
-    },
-    {
-      "href" : "http://c6403.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/services/KERBEROS/configurations/test_password",
-      "StackConfigurations" : {
-        "final" : "false",
-        "property_description" : "\n      The password for the administrative principal (either this value or the keytab value is\n      required to be set, neither is expected to be retained)\n    ",
-        "property_name" : "test_password",
-        "property_type" : [
-          "PASSWORD"
-        ],
-        "property_value" : "",
-        "service_name" : "KERBEROS",
-        "stack_name" : "HDP",
-        "stack_version" : "2.2",
-        "type" : "krb5-conf.xml"
-      }
-    },
-    {
-      "href" : "http://c6403.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/services/KERBEROS/configurations/test_principal",
-      "StackConfigurations" : {
-        "final" : "false",
-        "property_description" : "\n      The principal that may be used to test the Kerberos configuration (this will not be retained)\n    ",
-        "property_name" : "test_principal",
-        "property_type" : [ ],
-        "property_value" : "",
-        "service_name" : "KERBEROS",
-        "stack_name" : "HDP",
-        "stack_version" : "2.2",
-        "type" : "krb5-conf.xml"
-      }
     }
   ]
 }

+ 25 - 1
ambari-web/app/controllers/main/admin/kerberos/step2_controller.js

@@ -87,7 +87,9 @@ App.KerberosWizardStep2Controller = App.WizardStep7Controller.extend({
       self.createKerberosComponent().done(function () {
         self.createKerberosHostComponents().done(function () {
           self.createConfigurations().done(function () {
-            App.router.send('next');
+            self.createKerberosAdminSession().done(function() {
+              App.router.send('next');
+            });
           });
         });
       });
@@ -210,6 +212,28 @@ App.KerberosWizardStep2Controller = App.WizardStep7Controller.extend({
       }
     }, this);
     return {"type": site, "tag": tag, "properties": properties};
+  },
+
+  /**
+   * puts kerberos admin credentials in the live cluster session
+   * @returns {*} jqXHr
+   */
+  createKerberosAdminSession: function () {
+    var configs = this.get('stepConfigs')[0].get('configs');
+    var adminPrincipalValue = configs.findProperty('name','admin_principal').value;
+    var adminPasswordValue = configs.findProperty('name','admin_password').value;
+    return App.ajax.send({
+      name: 'common.cluster.update',
+      sender: this,
+      data: {
+        clusterName: App.get('clusterName') || App.clusterStatus.get('clusterName'),
+        data: [{
+          session_attributes : {
+            kerberos_admin : {principal : adminPrincipalValue, password : adminPasswordValue}
+          }
+        }]
+      }
+    });
   }
 });
 

+ 8 - 86
ambari-web/app/data/HDP2/site_properties.js

@@ -2154,7 +2154,7 @@ module.exports =
       "index": 0
     },
 
-  /********************************************* kerberos ********************************/
+  /********************************************* kerberos***********************************/
     {
       "id": "puppet var",
       "name": "kdc_type",
@@ -2219,12 +2219,11 @@ module.exports =
     },
     {
       "id": "puppet var",
-      "name": "test_principal",
-      "displayName": "Test principal",
-      "isRequired": false,
+      "name": "admin_principal",
+      "displayName": "Admin principal",
       "isOverridable": false,
       "isVisible": true,
-      "isRequiredByAgent": true,
+      "isRequiredByAgent": false,
       "serviceName": "KERBEROS",
       "filename": "krb5-conf.xml",
       "category": "KDC",
@@ -2232,30 +2231,17 @@ module.exports =
     },
     {
       "id": "puppet var",
-      "name": "test_password",
-      "displayName": "Test password",
-      "isRequired": false,
+      "name": "admin_password",
+      "displayName": "Admin password",
+      "displayType": "password",
       "isOverridable": false,
       "isVisible": true,
-      "isRequiredByAgent": true,
+      "isRequiredByAgent": false,
       "serviceName": "KERBEROS",
       "filename": "krb5-conf.xml",
       "category": "KDC",
       "index": 6
     },
-    {
-      "id": "puppet var",
-      "name": "test_keytab",
-      "displayName": "Test keytab",
-      "isRequired": false,
-      "isOverridable": false,
-      "isVisible": true,
-      "isRequiredByAgent": true,
-      "serviceName": "KERBEROS",
-      "filename": "krb5-conf.xml",
-      "category": "KDC",
-      "index": 7
-    },
     {
       "id": "puppet var",
       "name": "conf_dir",
@@ -2288,70 +2274,6 @@ module.exports =
       "category": "Advanced krb5-conf",
       "index": 1
     },
-    {
-      "id": "puppet var",
-      "name": "conf_dir",
-      "displayName": "kadm5-acl directory path",
-      "value": "",
-      "defaultValue": "",
-      "description": "",
-      "isOverridable": false,
-      "isVisible": true,
-      "isRequiredByAgent": true,
-      "displayType": "directory",
-      "serviceName": "KERBEROS",
-      "filename": "kadm5-acl.xml",
-      "category": "Advanced kadm5-acl",
-      "index": 0
-    },
-    {
-      "id": "puppet var",
-      "name": "content",
-      "displayName": "kadm5-conf template",
-      "value": "",
-      "defaultValue": "",
-      "description": "",
-      "isOverridable": false,
-      "isVisible": true,
-      "isRequiredByAgent": true,
-      "displayType": "content",
-      "serviceName": "KERBEROS",
-      "filename": "kadm5-acl.xml",
-      "category": "Advanced kadm5-acl",
-      "index": 1
-    },
-    {
-      "id": "puppet var",
-      "name": "conf_dir",
-      "displayName": "kdc-conf directory path",
-      "value": "",
-      "defaultValue": "",
-      "description": "",
-      "isOverridable": false,
-      "isVisible": true,
-      "isRequiredByAgent": true,
-      "displayType": "directory",
-      "serviceName": "KERBEROS",
-      "filename": "kdc-conf.xml",
-      "category": "Advanced kdc-conf",
-      "index": 0
-    },
-    {
-      "id": "puppet var",
-      "name": "content",
-      "displayName": "kdc-conf template",
-      "value": "",
-      "defaultValue": "",
-      "description": "",
-      "isOverridable": false,
-      "isVisible": true,
-      "isRequiredByAgent": true,
-      "displayType": "content",
-      "serviceName": "KERBEROS",
-      "filename": "kdc-conf.xml",
-      "category": "Advanced kdc-conf",
-      "index": 1
-    },
   /********************************************* flume-agent *****************************/
     {
       "id": "site property",

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

@@ -31,6 +31,17 @@ var App = require('app');
  */
 var urls = {
 
+  'common.cluster.update' : {
+    'type': 'PUT',
+    'real': '/clusters/{clusterName}',
+    'mock': '/data/wizard/deploy/poll_1.json',
+    'format': function (data) {
+      return {
+        data: JSON.stringify(data.data)
+      };
+    }
+  },
+
   'common.services.update' : {
     'real': '/clusters/{clusterName}/services?{urlParams}',
     'mock': '/data/wizard/deploy/poll_1.json',