diff --git a/src/sunstone/models/OpenNebulaJSON/TemplateJSON.rb b/src/sunstone/models/OpenNebulaJSON/TemplateJSON.rb index cffe2d095b..2a99b98da8 100644 --- a/src/sunstone/models/OpenNebulaJSON/TemplateJSON.rb +++ b/src/sunstone/models/OpenNebulaJSON/TemplateJSON.rb @@ -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 diff --git a/src/sunstone/public/app/opennebula/template.js b/src/sunstone/public/app/opennebula/template.js index e2153be56e..0325cd3f04 100644 --- a/src/sunstone/public/app/opennebula/template.js +++ b/src/sunstone/public/app/opennebula/template.js @@ -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); diff --git a/src/sunstone/public/app/tabs/provision-tab/templates/list.js b/src/sunstone/public/app/tabs/provision-tab/templates/list.js index 9d6b65e535..c90aa10c7e 100644 --- a/src/sunstone/public/app/tabs/provision-tab/templates/list.js +++ b/src/sunstone/public/app/tabs/provision-tab/templates/list.js @@ -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");