mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-16 22:50:10 +03:00
Feature #3748: Chmod in cloud view now applies to all the template images
This commit is contained in:
parent
8ef32e5676
commit
dffe1f1c52
@ -52,6 +52,8 @@ module OpenNebulaJSON
|
||||
when "rename" then self.rename(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"
|
||||
@ -122,7 +124,7 @@ module OpenNebulaJSON
|
||||
# Delete associated images
|
||||
self.each("TEMPLATE/DISK/IMAGE_ID"){|image_id|
|
||||
img = OpenNebula::Image.new_with_id(image_id.text, @client)
|
||||
rc = img.delete
|
||||
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
|
||||
@ -133,5 +135,21 @@ module OpenNebulaJSON
|
||||
# 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
|
||||
|
@ -30,6 +30,10 @@ 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);
|
||||
},
|
||||
"update" : function(params) {
|
||||
var action_obj = params.data.extra_param;
|
||||
OpenNebulaAction.simple_action(params, RESOURCE, "update", action_obj);
|
||||
|
@ -270,7 +270,6 @@ define(function(require) {
|
||||
context.on("click", ".provision_confirm_chmod_template_button", function(){
|
||||
var ul_context = $(this).parents(".provision-pricing-table");
|
||||
var template_id = ul_context.attr("opennebula_id");
|
||||
var image_id = ul_context.attr("saved_to_image_id");
|
||||
var template_name = $(".provision-title", ul_context).text();
|
||||
|
||||
$(".provision_confirm_delete_template_div", context).html(
|
||||
@ -284,7 +283,7 @@ define(function(require) {
|
||||
'</span>'+
|
||||
'</div>'+
|
||||
'<div class="large-4 columns">'+
|
||||
'<a href"#" class="provision_chmod_template_button success button large-12 radius right" style="margin-right: 15px" image_id="'+image_id+'" template_id="'+template_id+'">'+Locale.tr("Share template")+'</a>'+
|
||||
'<a href"#" class="provision_chmod_template_button success button large-12 radius right" style="margin-right: 15px" template_id="'+template_id+'">'+Locale.tr("Share template")+'</a>'+
|
||||
'</div>'+
|
||||
'</div>'+
|
||||
'<a href="#" class="close">×</a>'+
|
||||
@ -292,16 +291,13 @@ define(function(require) {
|
||||
});
|
||||
|
||||
context.on("click", ".provision_chmod_template_button", function(){
|
||||
/* TODO SAVED_TO_IMAGE_ID does not exists anymore and now all the images of the template
|
||||
are cloned instead of only the main disk, therefore all the images should be chmod now.
|
||||
Probably this could be done in the core
|
||||
|
||||
var button = $(this);
|
||||
button.attr("disabled", "disabled");
|
||||
|
||||
var template_id = $(this).attr("template_id");
|
||||
var image_id = $(this).attr("image_id");
|
||||
|
||||
OpenNebula.Template.chmod({
|
||||
OpenNebula.Template.chmod_from_provision({
|
||||
timeout: true,
|
||||
data : {
|
||||
id : template_id,
|
||||
@ -309,26 +305,14 @@ define(function(require) {
|
||||
},
|
||||
success: function (){
|
||||
$(".provision_templates_list_refresh_button", context).trigger("click");
|
||||
|
||||
OpenNebula.Image.chmod({
|
||||
timeout: true,
|
||||
data : {
|
||||
id : image_id,
|
||||
extra_param: {'group_u': 1}
|
||||
},
|
||||
success: function (){
|
||||
},
|
||||
error: Notifier.onError
|
||||
})
|
||||
},
|
||||
error: Notifier.onError
|
||||
})*/
|
||||
})
|
||||
});
|
||||
|
||||
context.on("click", ".provision_confirm_unshare_template_button", function(){
|
||||
var ul_context = $(this).parents(".provision-pricing-table");
|
||||
var template_id = ul_context.attr("opennebula_id");
|
||||
var image_id = ul_context.attr("saved_to_image_id");
|
||||
var template_name = $(".provision-title", ul_context).first().text();
|
||||
|
||||
$(".provision_confirm_delete_template_div", context).html(
|
||||
@ -342,7 +326,7 @@ define(function(require) {
|
||||
'</span>'+
|
||||
'</div>'+
|
||||
'<div class="large-4 columns">'+
|
||||
'<a href"#" class="provision_unshare_template_button success button large-12 radius right" style="margin-right: 15px" image_id="'+image_id+'" template_id="'+template_id+'">'+Locale.tr("Unshare template")+'</a>'+
|
||||
'<a href"#" class="provision_unshare_template_button success button large-12 radius right" style="margin-right: 15px" template_id="'+template_id+'">'+Locale.tr("Unshare template")+'</a>'+
|
||||
'</div>'+
|
||||
'</div>'+
|
||||
'<a href="#" class="close">×</a>'+
|
||||
@ -354,9 +338,8 @@ define(function(require) {
|
||||
button.attr("disabled", "disabled");
|
||||
|
||||
var template_id = $(this).attr("template_id");
|
||||
var image_id = $(this).attr("image_id");
|
||||
|
||||
OpenNebula.Template.chmod({
|
||||
OpenNebula.Template.chmod_from_provision({
|
||||
timeout: true,
|
||||
data : {
|
||||
id : template_id,
|
||||
@ -364,17 +347,6 @@ define(function(require) {
|
||||
},
|
||||
success: function (){
|
||||
$(".provision_templates_list_refresh_button", context).trigger("click");
|
||||
|
||||
OpenNebula.Image.chmod({
|
||||
timeout: true,
|
||||
data : {
|
||||
id : image_id,
|
||||
extra_param: {'group_u': 0}
|
||||
},
|
||||
success: function (){
|
||||
},
|
||||
error: Notifier.onError
|
||||
})
|
||||
},
|
||||
error: Notifier.onError
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user