You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2012/12/09 15:30:30 UTC

svn commit: r1418974 - in /incubator/ambari/branches/AMBARI-666/ambari-web/app: assets/data/wizard/bootstrap/ controllers/wizard/

Author: yusaku
Date: Sun Dec  9 14:30:27 2012
New Revision: 1418974

URL: http://svn.apache.org/viewvc?rev=1418974&view=rev
Log:
AMBARI-1059. Refactor cluster management. (yusaku)

Added:
    incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/wizard/bootstrap/single_host_information.json
    incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/wizard/bootstrap/single_host_registration.json
Modified:
    incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/wizard/bootstrap/poll_1.json
    incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/wizard/bootstrap/poll_2.json
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step3_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step5_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step6_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step9_controller.js

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/wizard/bootstrap/poll_1.json
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/wizard/bootstrap/poll_1.json?rev=1418974&r1=1418973&r2=1418974&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/wizard/bootstrap/poll_1.json (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/wizard/bootstrap/poll_1.json Sun Dec  9 14:30:27 2012
@@ -3,13 +3,8 @@
   "hostsStatus": [
     {
       "status": "RUNNING",
-      "hostName": "dev001",
+      "hostName": "localhost.localdomain",
       "log": "STDOUT\n\nSTDERR\nWarning: Permanently added 'dev001,10.0.2.15' (RSA) to the list of known hosts.\n"
-    },
-    {
-      "status": "RUNNING",
-      "hostName": "dev002",
-      "log": "STDOUT\n\nSTDERR\nWarning: Permanently added 'dev002,10.0.2.16' (RSA) to the list of known hosts.\n"
     }
   ],
   "log": ""

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/wizard/bootstrap/poll_2.json
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/wizard/bootstrap/poll_2.json?rev=1418974&r1=1418973&r2=1418974&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/wizard/bootstrap/poll_2.json (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/wizard/bootstrap/poll_2.json Sun Dec  9 14:30:27 2012
@@ -2,13 +2,8 @@
   "status": "SUCCESS",
   "hostsStatus": [
     {
-      "status": "FAILED",
-      "hostName": "dev001",
-      "log": "STDOUT\n\nSTDERR\nWarning: Permanently added 'dev001,10.0.2.15' (RSA) to the list of known hosts.\r\n/etc/yum.repos.d/ambari.repo: No such file or directory\nSTDOUT\n\nSTDERR\nPermission denied, please try again.\r\nConnection closed by UNKNOWN\r\nlost connection\nSTDOUT\n\nSTDERR\npython: can't open file '/tmp/setupAgent.py': [Errno 2] No such file or directory\n"
-    },
-    {
       "status": "DONE",
-      "hostName": "dev002",
+      "hostName": "localhost.localdomain",
       "log": "STDOUT\n\nSTDERR\nWarning: Permanently added 'dev002,10.0.2.16' (RSA) to the list of known hosts.\r\n/etc/yum.repos.d/ambari.repo: No such file or directory\nSTDOUT\n\nSTDERR\nPermission denied, please try again.\r\nConnection closed by UNKNOWN\r\nlost connection\nSTDOUT\n\nSTDERR\npython: can't open file '/tmp/setupAgent.py': [Errno 2] No such file or directory\n"
     }
   ],

Added: incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/wizard/bootstrap/single_host_information.json
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/wizard/bootstrap/single_host_information.json?rev=1418974&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/wizard/bootstrap/single_host_information.json (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/wizard/bootstrap/single_host_information.json Sun Dec  9 14:30:27 2012
@@ -0,0 +1,13 @@
+{
+  "href" : "http://localhost:8080/api/v1/hosts?fields=Hosts/total_mem,Hosts/cpu_count",
+  "items" : [
+    {
+      "href" : "http://localhost:8080/api/v1/hosts/localhost.localdomain",
+      "Hosts" : {
+        "cpu_count" : 1,
+        "total_mem" : 4057989,
+        "host_name" : "localhost.localdomain"
+      }
+    }
+  ]
+}
\ No newline at end of file

Added: incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/wizard/bootstrap/single_host_registration.json
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/wizard/bootstrap/single_host_registration.json?rev=1418974&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/wizard/bootstrap/single_host_registration.json (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/wizard/bootstrap/single_host_registration.json Sun Dec  9 14:30:27 2012
@@ -0,0 +1,11 @@
+{
+  "href" : "http://localhost:8080/api/v1/hosts",
+  "items" : [
+    {
+      "href" : "http://localhost:8080/api/v1/hosts/localhost.localdomain",
+      "Hosts" : {
+        "host_name" : "localhost.localdomain"
+      }
+    }
+  ]
+}
\ No newline at end of file

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step3_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step3_controller.js?rev=1418974&r1=1418973&r2=1418974&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step3_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step3_controller.js Sun Dec  9 14:30:27 2012
@@ -247,20 +247,30 @@ App.WizardStep3Controller = Em.Controlle
   isHostsRegistered: function (callback) {
     var self = this;
     var hosts = this.get('bootHosts');
-    var url = App.apiPrefix + '/hosts';
+    var url = App.testMode ? '/data/wizard/bootstrap/single_host_registration.json' : App.apiPrefix + '/hosts';
     var method = 'GET';
     $.ajax({
       type: 'GET',
       url: url,
       timeout: App.timeout,
       success: function (data) {
-        var jsonData = jQuery.parseJSON(data);
-        if (jsonData && jsonData.items.length === 0) {
+        var jsonData;
+        if (App.testMode) {
+          jsonData = data;
+        } else {
+          jsonData = jQuery.parseJSON(data);
+        }
+        if (!jsonData) {
+          console.log("Error: jsonData is null");
+          return;
+        }
+        if (jsonData.items.length === 0) {
           if (self.get('registrationAttempt') !== 0) {
             count--;
             window.setTimeout(function () {
               self.isHostsRegistered(callback);
             }, 3000);
+            return;
           } else {
             self.registerErrPopup(Em.I18n.t('installer.step3.hostRegister.popup.header'), Em.I18n.t('installer.step3.hostRegister.popup.body'));
             return;
@@ -303,7 +313,7 @@ App.WizardStep3Controller = Em.Controlle
     var self = this;
     var kbPerGb = 1024;
     var hosts = this.get('bootHosts');
-    var url = App.apiPrefix + '/hosts?fields=Hosts/total_mem,Hosts/cpu_count';
+    var url = App.testMode ? '/data/wizard/bootstrap/single_host_information.json' : App.apiPrefix + '/hosts?fields=Hosts/total_mem,Hosts/cpu_count';
     var method = 'GET';
     $.ajax({
       type: 'GET',
@@ -311,16 +321,21 @@ App.WizardStep3Controller = Em.Controlle
       contentType: 'application/json',
       timeout: App.timeout,
       success: function (data) {
-        var jsonData = jQuery.parseJSON(data);
+        var jsonData;
+        if (App.testMode) {
+          jsonData = data;
+        } else {
+          jsonData = jQuery.parseJSON(data);
+        }
         hosts.forEach(function (_host) {
           if (jsonData.items.someProperty('Hosts.host_name', _host.name)) {
             var host = jsonData.items.findProperty('Hosts.host_name', _host.name);
             _host.cpu = host.Hosts.cpu_count;
-            _host.memory = ((parseInt(host.Hosts.total_mem)) / kbPerGb).toFixed(2);
+            _host.memory = ((parseInt(host.Hosts.total_mem))).toFixed(2);
             console.log("The value of memory is: " + _host.memory);
           }
         }, this);
-        self.set('bootHosts',hosts);
+        self.set('bootHosts', hosts);
         console.log("The value of hosts: " + JSON.stringify(hosts));
         self.stopRegistrataion();
       },

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step5_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step5_controller.js?rev=1418974&r1=1418973&r2=1418974&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step5_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step5_controller.js Sun Dec  9 14:30:27 2012
@@ -58,7 +58,7 @@ App.WizardStep5Controller = Em.Controlle
 
     for (var index in hostInfo) {
       var _host = hostInfo[index];
-      if (_host.bootStatus === 'success' || true) {  // TODO: remove "true" after integrating with bootstrap
+      if (_host.bootStatus === 'DONE') {  // TODO: remove "true" after integrating with bootstrap
         var hostObj = Ember.Object.create({
           host_name:_host.name,
 

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step6_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step6_controller.js?rev=1418974&r1=1418973&r2=1418974&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step6_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step6_controller.js Sun Dec  9 14:30:27 2012
@@ -166,7 +166,7 @@ App.WizardStep6Controller = Em.Controlle
     var hostInfo = this.get('content.hostsInfo');
     var hostNames = [];
     for (var index in hostInfo) {
-      if (hostInfo[index].bootStatus === 'success' || true) //TODO: remove true after integration with bootstrap
+      if (hostInfo[index].bootStatus === 'DONE') //TODO: remove true after integration with bootstrap
         hostNames.push(hostInfo[index].name);
     }
     return hostNames;

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step9_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step9_controller.js?rev=1418974&r1=1418973&r2=1418974&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step9_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step9_controller.js Sun Dec  9 14:30:27 2012
@@ -91,8 +91,8 @@ App.WizardStep9Controller = Em.Controlle
       hosts.add(obj);
       console.log("TRACE: host name is: " + hostInfo[index].name);
     }
-    return hosts;
-    //return hosts.filterProperty('bootStatus', 'success'); //TODO: uncomment after actual hookup with bootstrap
+   // return hosts;
+    return hosts.filterProperty('bootStatus', 'DONE'); //TODO: uncomment after actual hookup with bootstrap
   },
 
   renderHosts: function (hostsInfo) {