feature #4184: Use template_raw in Template.update

Instead of using vmtemplate, use template_raw like the rest of resources
This commit is contained in:
Daniel Molina authored and Ruben S. Montero committed 2016-01-04 17:26:52 +01:00
1 parent 47c2bb5929
commit 8d0fa339a9
3 files changed
+4 -15

No files matched your search

@@ -70,14 +70,7 @@ module OpenNebulaJSON
end
def update(params=Hash.new)
template_hash = parse_json(params, 'vmtemplate')
if template_hash['template_raw']
template = template_hash['template_raw']
else
template = template_to_str(template_hash)
end
super(template)
super(params['template_raw'])
end
def chown(params=Hash.new)
@@ -51,7 +51,7 @@ define(function(require) {
OpenNebulaAction.simple_action(params, RESOURCE, "chmod_from_provision", action_obj);
},
"update" : function(params) {
var action_obj = params.data.extra_param;
var action_obj = {"template_raw" : params.data.extra_param};
OpenNebulaAction.simple_action(params, RESOURCE, "update", action_obj);
},
"publish" : function(params) {
@@ -158,9 +158,7 @@ define(function(require) {
{'vmtemplate': templateJSON});
return false;
} else if (this.action == "update") {
Sunstone.runAction("Template.update",
this.resourceId,
JSON.stringify({'vmtemplate': templateJSON}));
Sunstone.runAction("Template.update", this.resourceId, TemplateUtils.templateToString(templateJSON));
return false;
}
}
@@ -173,9 +171,7 @@ define(function(require) {
return false;
} else if (this.action == "update") {
Sunstone.runAction("Template.update",
this.resourceId,
JSON.stringify({"vmtemplate": {"template_raw": template}}));
Sunstone.runAction("Template.update", this.resourceId, template);
return false;
}
}