ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xiw...@apache.org
Subject [4/5] git commit: AMBARI-3733. Register Host: need to check host OS type if specific os group been selected at Advanced Repo in step1 .(xiwang)
Date Mon, 11 Nov 2013 21:57:47 GMT
AMBARI-3733. Register Host: need to check host OS type if specific os group been selected at
Advanced Repo in step1 .(xiwang)


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

Branch: refs/heads/trunk
Commit: dfde1a2135e5256f4c1839ba5cc30dab558ccbaf
Parents: e308a77
Author: Xi Wang <xiwang@apache.org>
Authored: Fri Nov 8 18:29:50 2013 -0800
Committer: Xi Wang <xiwang@apache.org>
Committed: Mon Nov 11 13:57:24 2013 -0800

----------------------------------------------------------------------
 .../app/controllers/wizard/step3_controller.js  | 54 ++++++++++++++++++++
 ambari-web/app/messages.js                      |  7 +++
 ambari-web/app/utils/ajax.js                    |  2 +-
 ambari-web/app/views/wizard/step3_view.js       |  4 +-
 4 files changed, 64 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/dfde1a21/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 460e5fa..1078d06 100644
--- a/ambari-web/app/controllers/wizard/step3_controller.js
+++ b/ambari-web/app/controllers/wizard/step3_controller.js
@@ -537,7 +537,10 @@ App.WizardStep3Controller = Em.Controller.extend({
 
   getHostInfoSuccessCallback: function (jsonData) {
     var hosts = this.get('bootHosts');
+    var self = this;
     this.parseWarnings(jsonData);
+    var repoWarnings = [];
+    var hostsContext = [];
     hosts.forEach(function (_host) {
       var host = (App.testMode) ? jsonData.items[0] : jsonData.items.findProperty('Hosts.host_name',
_host.name);
       if (App.skipBootstrap) {
@@ -548,10 +551,25 @@ App.WizardStep3Controller = Em.Controller.extend({
         _host.cpu = host.Hosts.cpu_count;
         _host.memory = ((parseInt(host.Hosts.total_mem))).toFixed(2);
         _host.disk_info = host.Hosts.disk_info;
+        _host.os_type = host.Hosts.os_type;
 
+        var context = self.checkHostOSType(host.Hosts.os_type, host.Hosts.host_name);
+        if(context) {
+          hostsContext.push(context);
+        }
         console.log("The value of memory is: " + _host.memory);
       }
     });
+    if (hostsContext.length > 0) { // warning exist
+      var repoWarning = {
+        name: 'Repository for OS not available',
+        hosts: hostsContext,
+        category: 'repositories',
+        onSingleHost: false
+      };
+      repoWarnings.push(repoWarning);
+    }
+    this.set('repoCategoryWarnings', repoWarnings);
     this.set('bootHosts', hosts);
     console.log("The value of hosts: " + JSON.stringify(hosts));
     this.stopRegistration();
@@ -567,6 +585,32 @@ App.WizardStep3Controller = Em.Controller.extend({
     this.set('isRetryDisabled', !this.get('bootHosts').someProperty('bootStatus', 'FAILED'));
   },
 
+  /**
+   * Check if the customized os group contains the registered host os type. If not the repo
on that host is invalid.
+   */
+  checkHostOSType: function (osType, hostName) {
+    var selectedStack = this.get('content.stacks').findProperty('isSelected', true);
+    var selectedOS = [];
+    var isValid = false;
+    if (selectedStack && selectedStack.operatingSystems) {
+      selectedStack.get('operatingSystems').filterProperty('selected', true).forEach( function(os)
{
+        selectedOS.pushObject(os.osType);
+        if ( os.osType == osType) {
+          isValid = true;
+        }
+      });
+    }
+
+    if (!isValid) {
+      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);
+    } else {
+      return null;
+    }
+
+  },
+
   selectCategory: function(event, context){
     this.set('category', event.context);
   },
@@ -921,6 +965,7 @@ App.WizardStep3Controller = Em.Controller.extend({
    */
   hostWarningsPopup: function(event){
     var self = this;
+    var repoCategoryWarnings = this.get('repoCategoryWarnings');
     App.ModalPopup.show({
 
       header: Em.I18n.t('installer.step3.warnings.popup.header'),
@@ -1010,6 +1055,15 @@ App.WizardStep3Controller = Em.Controller.extend({
           var categoryWarnings = this.get('categoryWarnings');
           return [
              Ember.Object.create({
+                warnings: repoCategoryWarnings,
+                title: Em.I18n.t('installer.step3.hostWarningsPopup.repositories'),
+                message: Em.I18n.t('installer.step3.hostWarningsPopup.repositories.message'),
+                type: Em.I18n.t('common.issues'),
+                emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.empty.repositories'),
+                action: Em.I18n.t('installer.step3.hostWarningsPopup.action.invalid'),
+                category: 'repositories'
+             }),
+             Ember.Object.create({
                warnings: categoryWarnings.filterProperty('category', 'firewall'),
                title: Em.I18n.t('installer.step3.hostWarningsPopup.firewall'),
                message: Em.I18n.t('installer.step3.hostWarningsPopup.firewall.message'),

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/dfde1a21/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 56bb4df..9c689cc 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -348,6 +348,8 @@ Em.I18n.translations = {
   'installer.step3.hosts.remove.popup.body':'Are you sure you want to remove the selected
host(s)?',
   'installer.step3.hostInformation.popup.header':'Error in retrieving host Information',
   'installer.step3.hostInformation.popup.body' : 'All bootstrapped hosts registered but unable
to retrieve cpu and memory related information',
+  'installer.step3.hostOsTypeCheck.popup.body' : 'Host registered successfully, but the host
operating system type NOT match the selected group in step 1:Advanced Repository Option.<br>
You can go back to step 1 OR remove this host. <br>' +
+    'The host type is {0}, but you selected group {1} in step 1.',
   'installer.step3.hostWarningsPopup.report':'Show Report',
   'installer.step3.hostWarningsPopup.report.header': '<p style="font-family: monospace">######################################<br>#
Host Checks Report<br>#<br># Generated: ',
   'installer.step3.hostWarningsPopup.report.hosts': '<br>######################################<br><br>######################################<br>#
Hosts<br>#<br># A space delimited list of hosts which have issues.<br>#
Provided so that administrators can easily copy hostnames into scripts, email etc.<br>######################################<br>HOSTS<br>',
@@ -364,6 +366,9 @@ Em.I18n.translations = {
     '<div class="alert alert-warn"><b>Note</b>: To clean up in interactive
mode, remove <b>--silent</b> option. To clean up all resources, including <i>users</i>,
remove <b>--skip=users</b> option. Use <b>--help</b> for a list of
available options.</div>',
   'installer.step3.hostWarningsPopup.summary':'{0} on {1}',
   'installer.step3.hostWarningsPopup.firewall':'Firewall Issues',
+  'installer.step3.hostWarningsPopup.repositories':'Repositories Issues',
+  '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.message':'The following registered hosts
have different Operating System types from the local repositories chosen in "Select Stack"
step. You can go back to "Select Stack" step to select another os group OR remove related
host.',
   'installer.step3.hostWarningsPopup.firewall.message':'Firewall is running on the following
hosts. Please configure the firewall to allow communications on the ports documented in the
<i>Configuring Ports</i> section of  the <a target=\"_blank\" href=\"http://incubator.apache.org/ambari/current/installing-hadoop-using-ambari/content/\">Ambari
documentation</a>',
   'installer.step3.hostWarningsPopup.firewall.name':'<i>iptables</i> Running',
   'installer.step3.hostWarningsPopup.process':'Process Issues',
@@ -389,10 +394,12 @@ Em.I18n.translations = {
   'installer.step3.hostWarningsPopup.empty.services':'unwanted services',
   'installer.step3.hostWarningsPopup.empty.misc':'issues',
   'installer.step3.hostWarningsPopup.empty.firewall':'firewalls running',
+  'installer.step3.hostWarningsPopup.empty.repositories':'repositories OS type mis-match
with registered hosts',
   'installer.step3.hostWarningsPopup.action.exists':'Exists on',
   'installer.step3.hostWarningsPopup.action.notRunning':'Not running on',
   'installer.step3.hostWarningsPopup.action.installed':'Installed on',
   'installer.step3.hostWarningsPopup.action.running':'Running on',
+  'installer.step3.hostWarningsPopup.action.invalid':'Invalid on',
   'installer.step3.hostWarningsPopup.host':'host',
   'installer.step3.hostWarningsPopup.hosts':'hosts',
   'installer.step3.hostWarningsPopup.moreHosts':'{0} more hosts...<br>Click on link
to view all hosts.',

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/dfde1a21/ambari-web/app/utils/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax.js b/ambari-web/app/utils/ajax.js
index 226224c..27655ce 100644
--- a/ambari-web/app/utils/ajax.js
+++ b/ambari-web/app/utils/ajax.js
@@ -976,7 +976,7 @@ var urls = {
     }
   },
   'wizard.step3.host_info': {
-    'real': '/hosts?fields=Hosts/total_mem,Hosts/cpu_count,Hosts/disk_info,Hosts/last_agent_env,Hosts/host_name',
+    'real': '/hosts?fields=Hosts/total_mem,Hosts/cpu_count,Hosts/disk_info,Hosts/last_agent_env,Hosts/host_name,Hosts/os_type',
     'mock': '/data/wizard/bootstrap/two_hosts_information.json',
     'format': function (data, opt) {
       return {

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/dfde1a21/ambari-web/app/views/wizard/step3_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step3_view.js b/ambari-web/app/views/wizard/step3_view.js
index f603059..2684506 100644
--- a/ambari-web/app/views/wizard/step3_view.js
+++ b/ambari-web/app/views/wizard/step3_view.js
@@ -50,7 +50,7 @@ App.WizardStep3View = Em.View.extend({
       this.set('status', 'alert-warn');
       this.set('linkText', '');
       this.set('message', Em.I18n.t('installer.step3.warnings.missingHosts'));
-    } else if (this.get('controller.isHostHaveWarnings')) {
+    } else if (this.get('controller.isHostHaveWarnings') || this.get('controller.repoCategoryWarnings.length'))
{
       this.set('status', 'alert-warn');
       this.set('linkText', Em.I18n.t('installer.step3.warnings.linkText'));
       this.set('message', Em.I18n.t('installer.step3.warnings.fails').format(hosts.length
- failedHosts));
@@ -70,7 +70,7 @@ App.WizardStep3View = Em.View.extend({
         this.set('message', Em.I18n.t('installer.step3.warnings.someWarnings').format((hosts.length-failedHosts),
failedHosts));
       }
     }
-  }.observes('controller.isHostHaveWarnings', 'controller.bootHosts.@each.bootStatus')
+  }.observes('controller.isHostHaveWarnings', 'controller.bootHosts.@each.bootStatus', 'controller.repoCategoryWarnings')
 });
 
 //todo: move it inside WizardStep3View


Mime
View raw message