Browse Source

AMBARI-9790. Incorrect oozieserver_host and knox_gateway_host initial values. (akovalenko)

Aleksandr Kovalenko 10 năm trước cách đây
mục cha
commit
58fb4135e8

+ 13 - 6
ambari-web/app/controllers/main/service/info/configs.js

@@ -1608,7 +1608,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
     if (configs.someProperty('name', 'oozie_database')) {
       var oozieDb = configs.findProperty('name', 'oozie_database');
       if (oozieDb.value === 'New Derby Database') {
-        configs = configs.without(configs.findProperty('name', 'oozie_ambari_host'));
         configs = configs.without(configs.findProperty('name', 'oozie_ambari_database'));
         configs = configs.without(configs.findProperty('name', 'oozie_existing_mysql_host'));
         configs = configs.without(configs.findProperty('name', 'oozie_existing_mysql_database'));
@@ -1642,7 +1641,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
         if (existingMySqlHost) {
           dbHostPropertyName = 'oozie_existing_mysql_host';
         }
-        configs = configs.without(configs.findProperty('name', 'oozie_ambari_host'));
         configs = configs.without(configs.findProperty('name', 'oozie_ambari_database'));
         configs = configs.without(configs.findProperty('name', 'oozie_existing_oracle_host'));
         configs = configs.without(configs.findProperty('name', 'oozie_existing_oracle_database'));
@@ -1660,7 +1658,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
         if (existingPostgreSqlHost) {
           dbHostPropertyName = 'oozie_existing_postgresql_host';
         }
-        configs = configs.without(configs.findProperty('name', 'oozie_ambari_host'));
         configs = configs.without(configs.findProperty('name', 'oozie_ambari_database'));
         configs = configs.without(configs.findProperty('name', 'oozie_existing_mysql_host'));
         configs = configs.without(configs.findProperty('name', 'oozie_existing_mysql_database'));
@@ -1676,7 +1673,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
         if (existingOracleHost) {
           dbHostPropertyName = 'oozie_existing_oracle_host';
         }
-        configs = configs.without(configs.findProperty('name', 'oozie_ambari_host'));
         configs = configs.without(configs.findProperty('name', 'oozie_ambari_database'));
         configs = configs.without(configs.findProperty('name', 'oozie_existing_mysql_host'));
         configs = configs.without(configs.findProperty('name', 'oozie_existing_mysql_database'));
@@ -1690,7 +1686,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
         if (existingMySqlServerHost) {
           dbHostPropertyName = 'oozie_existing_mssql_server_host';
         }
-        configs = configs.without(configs.findProperty('name', 'oozie_ambari_host'));
         configs = configs.without(configs.findProperty('name', 'oozie_ambari_database'));
         configs = configs.without(configs.findProperty('name', 'oozie_existing_oracle_host'));
         configs = configs.without(configs.findProperty('name', 'oozie_existing_oracle_database'));
@@ -1706,7 +1701,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
         if (existingMySql2ServerHost) {
           dbHostPropertyName = 'oozie_existing_mssql_server_2_host';
         }
-        configs = configs.without(configs.findProperty('name', 'oozie_ambari_host'));
         configs = configs.without(configs.findProperty('name', 'oozie_ambari_database'));
         configs = configs.without(configs.findProperty('name', 'oozie_existing_oracle_host'));
         configs = configs.without(configs.findProperty('name', 'oozie_existing_oracle_database'));
@@ -2204,10 +2198,23 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
       serviceUseThis: ['HIVE'],
       m: true
     },
+    {
+      hostProperty: 'hive_ambari_host',
+      componentName: 'HIVE_SERVER',
+      serviceName: 'HIVE',
+      serviceUseThis: []
+    },
     {
       hostProperty: 'oozieserver_host',
       componentName: 'OOZIE_SERVER',
       serviceName: 'OOZIE',
+      serviceUseThis: [],
+      m: true
+    },
+    {
+      hostProperty: 'oozie_ambari_host',
+      componentName: 'OOZIE_SERVER',
+      serviceName: 'OOZIE',
       serviceUseThis: []
     },
     {

+ 1 - 1
ambari-web/app/controllers/wizard/step8_controller.js

@@ -302,7 +302,7 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz
   removeOozieConfigs: function (configs) {
     var oozieDb = configs.findProperty('name', 'oozie_database');
     if (oozieDb) {
-      var oozie_properties = Em.A(['oozie_ambari_host', 'oozie_ambari_database']);
+      var oozie_properties = Em.A(['oozie_ambari_database']);
 
       switch (oozieDb.value) {
         case 'New Derby Database':

+ 3 - 2
ambari-web/app/data/BIGTOP/site_properties.js

@@ -2654,6 +2654,7 @@ module.exports =
       "displayType": "masterHost",
       "isOverridable": false,
       "isVisible": false,
+      "isRequiredByAgent": false,
       "serviceName": "HIVE",
       "filename": "hive-env.xml",
       "category": "HIVE_METASTORE",
@@ -2780,8 +2781,8 @@ module.exports =
       "displayName": "Oozie Server host",
       "value": "",
       "defaultValue": "",
-      "description": "The host that has been assigned to run Oozie Server",
-      "displayType": "masterHost",
+      "description": "The hosts that have been assigned to run Oozie Server",
+      "displayType": "masterHosts",
       "isOverridable": false,
       "isVisible": true,
       "isRequiredByAgent": false,

+ 5 - 4
ambari-web/app/data/HDP2/site_properties.js

@@ -1735,8 +1735,8 @@ var hdp2properties = [
     "displayName": "Knox Gateway host",
     "value": "",
     "defaultValue": "",
-    "description": "The host that has been assigned to run Knox Gateway",
-    "displayType": "masterHost",
+    "description": "The hosts that have been assigned to run Knox Gateway",
+    "displayType": "masterHosts",
     "isOverridable": false,
     "isVisible": true,
     "isRequiredByAgent": false,
@@ -3075,6 +3075,7 @@ var hdp2properties = [
     "displayType": "masterHost",
     "isOverridable": false,
     "isVisible": false,
+    "isRequiredByAgent": false,
     "serviceName": "HIVE",
     "filename": "hive-env.xml",
     "category": "HIVE_METASTORE",
@@ -3254,8 +3255,8 @@ var hdp2properties = [
     "displayName": "Oozie Server host",
     "value": "",
     "defaultValue": "",
-    "description": "The host that has been assigned to run Oozie Server",
-    "displayType": "masterHost",
+    "description": "The hosts that have been assigned to run Oozie Server",
+    "displayType": "masterHosts",
     "isOverridable": false,
     "isVisible": true,
     "isRequiredByAgent": false,

+ 3 - 2
ambari-web/app/data/PHD/site_properties.js

@@ -2503,6 +2503,7 @@ module.exports =
       "displayType": "masterHost",
       "isOverridable": false,
       "isVisible": false,
+      "isRequiredByAgent": false,
       "serviceName": "HIVE",
       "filename": "hive-env.xml",
       "category": "HIVE_METASTORE",
@@ -2629,8 +2630,8 @@ module.exports =
       "displayName": "Oozie Server host",
       "value": "",
       "defaultValue": "",
-      "description": "The host that has been assigned to run Oozie Server",
-      "displayType": "masterHost",
+      "description": "The hosts that have been assigned to run Oozie Server",
+      "displayType": "masterHosts",
       "isOverridable": false,
       "isVisible": true,
       "isRequiredByAgent": false,

+ 2 - 2
ambari-web/app/models/service_config.js

@@ -461,7 +461,7 @@ App.ServiceConfigProperty = Em.Object.extend({
         }
         break;
       case 'oozieserver_host':
-        this.set('value', masterComponentHostsInDB.findProperty('component', 'OOZIE_SERVER').hostName);
+        this.set('value', masterComponentHostsInDB.filterProperty('component', 'OOZIE_SERVER').mapProperty('hostName'));
         break;
       case 'oozie.base.url':
         var oozieHost = masterComponentHostsInDB.findProperty('component', 'OOZIE_SERVER').hostName;
@@ -527,7 +527,7 @@ App.ServiceConfigProperty = Em.Object.extend({
         this.set('value', slaveComponentHostsInDB.findProperty('componentName', 'SUPERVISOR').hosts.mapProperty('hostName'));
         break;
       case 'knox_gateway_host':
-        this.set('value', masterComponentHostsInDB.findProperty('component', 'KNOX_GATEWAY').hostName);
+        this.set('value', masterComponentHostsInDB.filterProperty('component', 'KNOX_GATEWAY').mapProperty('hostName'));
         break;
       case 'kafka_broker_hosts':
         this.set('value', masterComponentHostsInDB.filterProperty('component', 'KAFKA_BROKER').mapProperty('hostName'));

+ 1 - 1
ambari-web/app/views/common/controls_view.js

@@ -1026,7 +1026,7 @@ App.CheckDBConnectionView = Ember.View.extend({
   /** @property {String} masterHostName - host name location of Master Component related to Service **/
   masterHostName: function() {
     var serviceMasterMap = {
-      'OOZIE': 'oozieserver_host',
+      'OOZIE': 'oozie_ambari_host',
       'HDFS': 'hadoop_host',
       'HIVE': 'hive_ambari_host',
       'KERBEROS': 'kdc_host'

+ 44 - 0
ambari-web/test/models/service_config_test.js

@@ -846,6 +846,38 @@ describe('App.ServiceConfigProperty', function () {
         defaultValue: 'localhost:2181',
         value: 'h0:2182',
         title: 'should add ZK host and port dynamically'
+      },
+      'oozieserver_host': {
+        localDB: {
+          masterComponentHosts: [
+            {
+              component: 'OOZIE_SERVER',
+              hostName: 'h0'
+            },
+            {
+              component: 'OOZIE_SERVER',
+              hostName: 'h1'
+            }
+          ]
+        },
+        value: ['h0', 'h1'],
+        title: 'array that contains names of hosts with Oozie Server'
+      },
+      'knox_gateway_host': {
+        localDB: {
+          masterComponentHosts: [
+            {
+              component: 'KNOX_GATEWAY',
+              hostName: 'h0'
+            },
+            {
+              component: 'KNOX_GATEWAY',
+              hostName: 'h1'
+            }
+          ]
+        },
+        value: ['h0', 'h1'],
+        title: 'array that contains names of hosts with Knox Gateway'
       }
     };
 
@@ -962,6 +994,18 @@ describe('App.ServiceConfigProperty', function () {
       expect(serviceConfigProperty.get('defaultValue')).to.equal(cases['yarn.resourcemanager.zk-address'].value);
     });
 
+    it(cases['oozieserver_host'].title, function () {
+      serviceConfigProperty.set('name', 'oozieserver_host');
+      serviceConfigProperty.initialValue(cases['oozieserver_host'].localDB);
+      expect(serviceConfigProperty.get('value')).to.eql(cases['oozieserver_host'].value);
+    });
+
+    it(cases['knox_gateway_host'].title, function () {
+      serviceConfigProperty.set('name', 'knox_gateway_host');
+      serviceConfigProperty.initialValue(cases['knox_gateway_host'].localDB);
+      expect(serviceConfigProperty.get('value')).to.eql(cases['knox_gateway_host'].value);
+    });
+
   });
 
   describe('#getHiveMetastoreUris', function () {

+ 1 - 1
ambari-web/test/views/common/controls_view_test.js

@@ -625,7 +625,7 @@ describe('App.CheckDBConnectionView', function () {
       ],
       categoryConfigsAll = [
         Em.Object.create({
-          name: 'oozieserver_host',
+          name: 'oozie_ambari_host',
           value: 'h0'
         }),
         Em.Object.create({