bug 12730

Wait for builtin templates before install wizard completes

status 12730: resolved fixed
This commit is contained in:
bfederle 2012-01-31 12:01:14 -08:00
parent 07545236d7
commit 0e03e0d5fd
1 changed files with 28 additions and 4 deletions

View File

@ -283,8 +283,6 @@
var poll = setInterval(function() {
$.ajax({
url: createURL('listSystemVms'),
dataType: 'json',
async: true,
success: function(data) {
var systemVMs = data.listsystemvmsresponse.systemvm;
@ -293,8 +291,8 @@
return vm.state == 'Running';
}).length) {
clearInterval(poll);
message('Installation completed!');
setTimeout(success, 2000);
message('System VMs ready.');
setTimeout(pollBuiltinTemplates, 500);
}
}
}
@ -302,6 +300,32 @@
}, 5000);
};
// Wait for builtin template to be present -- otherwise VMs cannot launch
var pollBuiltinTemplates = function() {
message('Waiting for builtin templates to load...');
var poll = setInterval(function() {
$.ajax({
url: createURL('listTemplates'),
data: {
templatefilter: 'all'
},
success: function(data) {
var templates = data.listtemplatesresponse.template ?
data.listtemplatesresponse.template : [];
var builtinTemplates = $.grep(templates, function(template) {
return template.templatetype == 'BUILTIN';
});
if (builtinTemplates.length) {
clearInterval(poll);
message('Your CloudStack is ready!');
setTimeout(success, 1000);
}
}
});
}, 5000);
};
enableZone();
}
}