Skip to content
Browse files

AMBARI-1059. Refactor cluster management. (yusaku)

  • Loading branch information...
1 parent 762191f commit 18f6dd5c550d39e8658f8bf16a3edf2e98a2a2d8 Yusaku Sako committed Dec 9, 2012
View
7 ambari-web/app/assets/data/wizard/bootstrap/poll_1.json
@@ -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": ""
View
7 ambari-web/app/assets/data/wizard/bootstrap/poll_2.json
@@ -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"
}
],
View
13 ambari-web/app/assets/data/wizard/bootstrap/single_host_information.json
@@ -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"
+ }
+ }
+ ]
+}
View
11 ambari-web/app/assets/data/wizard/bootstrap/single_host_registration.json
@@ -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"
+ }
+ }
+ ]
+}
View
29 ambari-web/app/controllers/wizard/step3_controller.js
@@ -247,20 +247,30 @@ App.WizardStep3Controller = Em.Controller.extend({
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,24 +313,29 @@ App.WizardStep3Controller = Em.Controller.extend({
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',
url: url,
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();
},
View
2 ambari-web/app/controllers/wizard/step5_controller.js
@@ -58,7 +58,7 @@ App.WizardStep5Controller = Em.Controller.extend({
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,
View
2 ambari-web/app/controllers/wizard/step6_controller.js
@@ -166,7 +166,7 @@ App.WizardStep6Controller = Em.Controller.extend({
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;
View
4 ambari-web/app/controllers/wizard/step9_controller.js
@@ -91,8 +91,8 @@ App.WizardStep9Controller = Em.Controller.extend({
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) {

0 comments on commit 18f6dd5

Please sign in to comment.
Something went wrong with that request. Please try again.