瀏覽代碼

AMBARI-5851. Host Checks: Repository Issue should not exist due to repo OS name changes.(xiwang)

Xi Wang 11 年之前
父節點
當前提交
e924455a21
共有 2 個文件被更改,包括 24 次插入5 次删除
  1. 23 4
      ambari-web/app/controllers/wizard/step3_controller.js
  2. 1 1
      ambari-web/app/messages.js

+ 23 - 4
ambari-web/app/controllers/wizard/step3_controller.js

@@ -818,28 +818,47 @@ App.WizardStep3Controller = Em.Controller.extend({
     if (this.get('content.stacks')) {
     if (this.get('content.stacks')) {
       var selectedStack = this.get('content.stacks').findProperty('isSelected', true);
       var selectedStack = this.get('content.stacks').findProperty('isSelected', true);
       var selectedOS = [];
       var selectedOS = [];
+      var self = this;
       var isValid = false;
       var isValid = false;
       if (selectedStack && selectedStack.operatingSystems) {
       if (selectedStack && selectedStack.operatingSystems) {
         selectedStack.get('operatingSystems').filterProperty('selected', true).forEach(function (os) {
         selectedStack.get('operatingSystems').filterProperty('selected', true).forEach(function (os) {
           selectedOS.pushObject(os.osType);
           selectedOS.pushObject(os.osType);
-          if (os.osType == osType) {
+          if (self.repoToAgentOsType(os.osType).indexOf(osType) >= 0) {
             isValid = true;
             isValid = true;
           }
           }
         });
         });
       }
       }
-
       if (isValid) {
       if (isValid) {
         return '';
         return '';
       } else {
       } else {
         console.log('WARNING: Getting host os type does NOT match the user selected os group in step1. ' +
         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);
-        return Em.I18n.t('installer.step3.hostWarningsPopup.repositories.context').format(hostName, osType, selectedOS);
+          '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());
       }
       }
     } else {
     } else {
       return '';
       return '';
     }
     }
   },
   },
 
 
+  /**
+   * 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) {
+    switch (repoType) {
+      case "redhat6":
+        return ["redhat6", "centos6", "oraclelinux6", "rhel6"];
+      case "redhat5":
+        return ["redhat5", "centos5", "oraclelinux5", "rhel5"];
+      case "suse11":
+        return ["suse11", "sles11", "opensuse11"];
+      case "debian12":
+        return ["debian12", "ubuntu12"];
+    }
+  },
+
   /**
   /**
    * Check if current host has enough free disk usage.
    * Check if current host has enough free disk usage.
    * @param {string} hostName
    * @param {string} hostName

+ 1 - 1
ambari-web/app/messages.js

@@ -468,7 +468,7 @@ Em.I18n.translations = {
   'installer.step3.hostWarningsPopup.summary':'{0} on {1}',
   'installer.step3.hostWarningsPopup.summary':'{0} on {1}',
   'installer.step3.hostWarningsPopup.repositories':'Repository Issues',
   'installer.step3.hostWarningsPopup.repositories':'Repository Issues',
   'installer.step3.hostWarningsPopup.repositories.name':'Repository for OS not available',
   'installer.step3.hostWarningsPopup.repositories.name':'Repository for OS not available',
-  'installer.step3.hostWarningsPopup.repositories.context':'Host ({0}) has a {1} OS type, But the repositories chosen in "Select Stack" step was {2}.',
+  'installer.step3.hostWarningsPopup.repositories.context':'Host ({0}) is {1} OS type, but the repositories chosen in "Select Stack" step was {2}. Selected repositories dont support such host OS type.',
   'installer.step3.hostWarningsPopup.repositories.message': 'The following registered hosts have different Operating System types from the available Repositories chosen in "Select Stack" step. You can go back to "Select Stack" step to select another OS repository <b>or</b> remove the host.',
   'installer.step3.hostWarningsPopup.repositories.message': 'The following registered hosts have different Operating System types from the available Repositories chosen in "Select Stack" step. You can go back to "Select Stack" step to select another OS repository <b>or</b> remove the host.',
   'installer.step3.hostWarningsPopup.disk':'Disk Issues',
   'installer.step3.hostWarningsPopup.disk':'Disk Issues',
   'installer.step3.hostWarningsPopup.disk.name':'Not enough disk space ',
   'installer.step3.hostWarningsPopup.disk.name':'Not enough disk space ',