1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-26 06:50:09 +03:00

Feature #4317: Remove _from_provision actions

This commit is contained in:
Carlos Martín 2016-02-15 18:29:40 +01:00
parent e52996856d
commit 5cb2caf403
3 changed files with 11 additions and 48 deletions

View File

@ -51,10 +51,6 @@ module OpenNebulaJSON
when "clone" then self.clone(action_hash['params'])
when "rename" then self.rename(action_hash['params'])
when "delete_recursive" then self.delete_recursive(action_hash['params'])
when "delete_from_provision"
then self.delete_from_provision(action_hash['params'])
when "chmod_from_provision"
then self.chmod_from_provision(action_hash['params'])
else
error_msg = "#{action_hash['perform']} action not " <<
" available for this resource"
@ -127,37 +123,5 @@ module OpenNebulaJSON
recursive = (params['recursive'] == true)
self.delete(recursive)
end
def delete_from_provision(params=Hash.new)
# Delete associated images
self.each("TEMPLATE/DISK/IMAGE_ID"){|image_id|
img = OpenNebula::Image.new_with_id(image_id.text, @client)
rc = img.delete
if OpenNebula::is_error?(rc)
error_msg = "Some of the resources associated with " <<
"this template couldn't be deleted. Error: " << rc.message
return OpenNebula::Error.new(error_msg)
end
}
# Delete template
self.delete
end
def chmod_from_provision(params=Hash.new)
# Chmod associated images
self.each("TEMPLATE/DISK/IMAGE_ID"){|image_id|
img = OpenNebulaJSON::ImageJSON.new_with_id(image_id.text, @client)
rc = img.chmod_json(params)
if OpenNebula::is_error?(rc)
error_msg = "Some of the resources associated with " <<
"this template couldn't be published. Error: " << rc.message
return OpenNebula::Error.new(error_msg)
end
}
# Chmod template
self.chmod_json(params)
end
end
end

View File

@ -32,9 +32,6 @@ define(function(require) {
var action_obj = {"recursive": true};
OpenNebulaAction.simple_action(params, RESOURCE, "delete_recursive", action_obj);
},
"delete_from_provision": function(params) {
OpenNebulaAction.simple_action(params, RESOURCE, "delete_from_provision");
},
"list" : function(params) {
OpenNebulaAction.list(params, RESOURCE);
},
@ -51,10 +48,6 @@ define(function(require) {
var action_obj = params.data.extra_param;
OpenNebulaAction.simple_action(params, RESOURCE, "chmod", action_obj);
},
"chmod_from_provision": function(params) {
var action_obj = params.data.extra_param;
OpenNebulaAction.simple_action(params, RESOURCE, "chmod_from_provision", action_obj);
},
"append": function(params) {
var action_obj = {"template_raw" : params.data.extra_param, append : true};
OpenNebulaAction.simple_action(params, RESOURCE, "update", action_obj);

View File

@ -263,7 +263,7 @@ define(function(require) {
var template_id = $(this).attr("template_id");
OpenNebula.Template.delete_from_provision({
OpenNebula.Template.delete_recursive({
timeout: true,
data : {
id : template_id
@ -311,11 +311,14 @@ define(function(require) {
var template_id = $(this).attr("template_id");
OpenNebula.Template.chmod_from_provision({
OpenNebula.Template.chmod({
timeout: true,
data : {
id : template_id,
extra_param: {'group_u': 1}
extra_param: {
'group_u': 1,
'recursive' : true
}
},
success: function (){
$(".provision_templates_list_refresh_button", context).trigger("click");
@ -353,11 +356,14 @@ define(function(require) {
var template_id = $(this).attr("template_id");
OpenNebula.Template.chmod_from_provision({
OpenNebula.Template.chmod({
timeout: true,
data : {
id : template_id,
extra_param: {'group_u': 0}
extra_param: {
'group_u': 0,
'recursive' : true
}
},
success: function (){
$(".provision_templates_list_refresh_button", context).trigger("click");