ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject [2/3] ambari git commit: AMBARI-10296. UI hard codes OS family mappings causing hostChecks to fail (alexantonenko)
Date Wed, 01 Apr 2015 13:23:37 GMT
AMBARI-10296. UI hard codes OS family mappings causing hostChecks to fail (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 72cf909a822b498d9e6d1f769d345c2d2a7f7bcb
Parents: 7450f4e
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Wed Apr 1 15:56:01 2015 +0300
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Wed Apr 1 16:23:32 2015 +0300

----------------------------------------------------------------------
 .../app/controllers/wizard/step3_controller.js  | 34 ++++----------------
 ambari-web/app/utils/ajax/ajax.js               |  2 +-
 .../test/controllers/wizard/step3_test.js       |  2 ++
 3 files changed, 9 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/72cf909a/ambari-web/app/controllers/wizard/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step3_controller.js b/ambari-web/app/controllers/wizard/step3_controller.js
index d68059e..34a2728 100644
--- a/ambari-web/app/controllers/wizard/step3_controller.js
+++ b/ambari-web/app/controllers/wizard/step3_controller.js
@@ -1107,7 +1107,7 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin,
{
           self._setHostDataFromLoadedHostInfo(_host, host);
           var host_name = Em.get(host, 'Hosts.host_name');
 
-          var context = self.checkHostOSType(host.Hosts.os_type, host_name);
+          var context = self.checkHostOSType(host.Hosts.os_family, host_name);
           if (context) {
             hostsContext.push(context);
             hostsRepoNames.push(host_name);
@@ -1195,6 +1195,7 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin,
{
       return h.mountpoint != "/boot"
     }));
     host.set('os_type', Em.get(hostInfo, 'Hosts.os_type'));
+    host.set('os_family', Em.get(hostInfo, 'Hosts.os_family'));
     host.set('os_arch', Em.get(hostInfo, 'Hosts.os_arch'));
     host.set('ip', Em.get(hostInfo, 'Hosts.ip'));
     return host;
@@ -1241,16 +1242,15 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin,
{
    * @return {string} error-message or empty string
    * @method checkHostOSType
    */
-  checkHostOSType: function (osType, hostName) {
+  checkHostOSType: function (osFamily, hostName) {
     if (this.get('content.stacks')) {
       var selectedStack = this.get('content.stacks').findProperty('isSelected', true);
       var selectedOS = [];
-      var self = this;
       var isValid = false;
       if (selectedStack && selectedStack.get('operatingSystems')) {
         selectedStack.get('operatingSystems').filterProperty('isSelected', true).forEach(function
(os) {
           selectedOS.pushObject(os.get('osType'));
-          if (self.repoToAgentOsType(os.get('osType')).indexOf(osType) >= 0) {
+          if (os.get('osType') === osFamily) {
             isValid = true;
           }
         });
@@ -1259,8 +1259,8 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin,
{
         return '';
       } else {
         console.log('WARNING: Getting host os type does NOT match the user selected os group
in step1. ' +
-          'Host Name: ' + hostName + '. Host os type:' + osType + '. Selected group:' + selectedOS.uniq());
-        return Em.I18n.t('installer.step3.hostWarningsPopup.repositories.context').format(hostName,
osType, selectedOS.uniq());
+          'Host Name: ' + hostName + '. Host os type:' + osFamily + '. Selected group:' +
selectedOS.uniq());
+        return Em.I18n.t('installer.step3.hostWarningsPopup.repositories.context').format(hostName,
osFamily, selectedOS.uniq());
       }
     } else {
       return '';
@@ -1268,28 +1268,6 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin,
{
   },
 
   /**
-   * return the supported agent os types for a repo os type
-   * @param {String} repoType
-   * @return {Array} supported agent os type array
-   * @method repoToAgentOsType
-   */
-  repoToAgentOsType : function (repoType) {
-    /* istanbul ignore next */
-    switch (repoType) {
-      case "redhat6":
-        return ["redhat6", "centos6", "oraclelinux6", "rhel6"];
-      case "redhat5":
-        return ["redhat5", "centos5", "oraclelinux5", "rhel5"];
-      case "suse11":
-        return ["suse11", "sles11", "opensuse11"];
-      case "ubuntu12":
-        return ["debian12", "ubuntu12"];
-      default:
-        return [];
-    }
-  },
-
-  /**
    * Check if current host has enough free disk usage.
    * @param {string} hostName
    * @param {object} diskInfo

http://git-wip-us.apache.org/repos/asf/ambari/blob/72cf909a/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 7b7c6fb..ab722cc 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -1784,7 +1784,7 @@ var urls = {
     'mock': '/data/requests/host_check/jdk_check_results.json'
   },
   'wizard.step3.host_info': {
-    'real': '/hosts?fields=Hosts/total_mem,Hosts/cpu_count,Hosts/disk_info,Hosts/last_agent_env,Hosts/host_name,Hosts/os_type,Hosts/os_arch,Hosts/ip',
+    'real': '/hosts?fields=Hosts/total_mem,Hosts/cpu_count,Hosts/disk_info,Hosts/last_agent_env,Hosts/host_name,Hosts/os_type,Hosts/os_arch,Hosts/os_family,Hosts/ip',
     'mock': '/data/wizard/bootstrap/two_hosts_information.json',
     'format': function () {
       return {

http://git-wip-us.apache.org/repos/asf/ambari/blob/72cf909a/ambari-web/test/controllers/wizard/step3_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step3_test.js b/ambari-web/test/controllers/wizard/step3_test.js
index e15620d..107c3a4 100644
--- a/ambari-web/test/controllers/wizard/step3_test.js
+++ b/ambari-web/test/controllers/wizard/step3_test.js
@@ -2176,6 +2176,7 @@ describe('App.WizardStep3Controller', function () {
             total_mem: 12345,
             os_type: 't1',
             os_arch: 'os1',
+            os_family: 'osf1',
             ip: '0.0.0.0',
             disk_info: [
               {mountpoint: '/boot'},
@@ -2189,6 +2190,7 @@ describe('App.WizardStep3Controller', function () {
       expect(host.get('cpu')).to.equal(2);
       expect(host.get('os_type')).to.equal('t1');
       expect(host.get('os_arch')).to.equal('os1');
+      expect(host.get('os_family')).to.equal('osf1')
       expect(host.get('ip')).to.equal('0.0.0.0');
       expect(host.get('memory')).to.equal('12345.00');
       expect(host.get('disk_info.length')).to.equal(2);


Mime
View raw message