1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-20 10:50:08 +03:00

Bug #2293: In VM template update, replace \" with ' on client, and replace back in Sunstone server.

This commit is contained in:
Tino Vazquez 2013-09-20 16:11:20 +02:00
parent 48512ff93b
commit 436ef22ba7
2 changed files with 11 additions and 13 deletions

View File

@ -66,6 +66,12 @@ module OpenNebulaJSON
template = template_to_str(template_hash)
end
# Substitue single quotes (not supported by ONE core)
# with \" (supported)
template.gsub!(/'/,"\\\"")
File.open("/tmp/opa","w"){|f| f.write template}
super(template)
end

View File

@ -4132,6 +4132,8 @@ function setupCreateTemplateDialog(){
vm_json = {vmtemplate: vm_json};
vm_json =JSON.stringify(vm_json);
vm_json=vm_json.replace(/\\\"/g,"'");
Sunstone.runAction("Template.update",template_to_update_id,vm_json);
$create_template_dialog.trigger("reveal:close")
@ -4145,6 +4147,9 @@ function setupCreateTemplateDialog(){
//wrap it in the "vm" object
template = {"vmtemplate": {"template_raw": template}};
var vm_json = JSON.stringify(template);
vm_json=vm_json.replace(/\\\"/g,"'");
Sunstone.runAction("Template.update",template_to_update_id,vm_json);
$create_template_dialog.trigger("reveal:close")
@ -4163,15 +4168,6 @@ function setupCreateTemplateDialog(){
$create_template_dialog.trigger("reveal:close")
return false;
});
//Reset form - empty boxes
//$('button#reset_vm_form',dialog).click(function(){
// $('select#disks_box option',section_disks).remove();
// $('select#nics_box option',section_networks).remove();
// $('select#inputs_box option',section_inputs).remove();
// $('select#custom_var_box option',section_custom_var).remove();
// return true;
//});
}
function popUpUpdateTemplateDialog(){
@ -4188,9 +4184,6 @@ function popUpUpdateTemplateDialog(){
$('#template_name_form', $create_template_dialog).hide();
$('#NAME').attr("disabled", "disabled");;
//$('#wizard_mode', $create_template_dialog).hide();
//$('#advanced_mode_a', $create_template_dialog).click();
$create_template_dialog.reveal();
};
@ -4365,7 +4358,6 @@ function fillTemplatePopUp(request, response){
// TODO updateView should not be required. Currently the dataTable
// is filled twice.
update_datatable_template_networks(dataTable_template_networks, function(){
//dataTable_template_networks.unbind('draw');
if (nic_network_id) {
var clicked = false