From 048c8991a3d4fbb57ec580b1735db137b7bbb7bf Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Mon, 29 Feb 2016 19:28:48 +0100 Subject: [PATCH] feature #4317: Set error message and code when some images cannot be chmod'ed in a recursive operation --- src/rm/RequestManagerChmod.cc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/rm/RequestManagerChmod.cc b/src/rm/RequestManagerChmod.cc index ded9a2a578..63d85cecab 100644 --- a/src/rm/RequestManagerChmod.cc +++ b/src/rm/RequestManagerChmod.cc @@ -214,6 +214,9 @@ void TemplateChmod::request_execute(xmlrpc_c::paramList const& paramList, { VMTemplate* tmpl = static_cast(pool)->get(oid, true); + int rc = 0; + set error_ids; + if ( tmpl == 0 ) { att.resp_id = oid; @@ -238,9 +241,20 @@ void TemplateChmod::request_execute(xmlrpc_c::paramList const& paramList, if (ec != SUCCESS) { NebulaLog::log("ReM", Log::ERROR, failure_message(ec, att)); - } - // TODO rollback? + error_ids.insert(*it); + rc = -1; + } + } + + if ( rc != 0 ) + { + att.resp_msg = "Cannot chmod " + object_name(PoolObjectSQL::IMAGE) + + ": " + one_util::join::iterator>(error_ids.begin(), + error_ids.end(), ','); + + failure_response(ACTION, att); + return; } }