mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-20 20:02:38 +09:00
This commit is contained in:
1 parent
fb85a67d6b
commit
1fd5dadcf4
9 files changed
+218
-180
No files matched your search
@@ -167,7 +167,8 @@ void PoolObjectSQL::clear_template_error_message()
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int PoolObjectSQL::replace_template(const string& tmpl_str, string& error)
|
||||
int PoolObjectSQL::replace_template(
|
||||
const string& tmpl_str, bool keep_restricted, string& error)
|
||||
{
|
||||
Template * new_tmpl = get_new_template();
|
||||
|
||||
@@ -183,6 +184,19 @@ int PoolObjectSQL::replace_template(const string& tmpl_str, string& error)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (keep_restricted)
|
||||
{
|
||||
new_tmpl->remove_restricted();
|
||||
|
||||
if (obj_template != 0)
|
||||
{
|
||||
obj_template->remove_all_except_restricted();
|
||||
|
||||
string aux_error;
|
||||
new_tmpl->merge(obj_template, aux_error);
|
||||
}
|
||||
}
|
||||
|
||||
delete obj_template;
|
||||
|
||||
obj_template = new_tmpl;
|
||||
@@ -193,7 +207,8 @@ int PoolObjectSQL::replace_template(const string& tmpl_str, string& error)
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int PoolObjectSQL::append_template(const string& tmpl_str, string& error)
|
||||
int PoolObjectSQL::append_template(
|
||||
const string& tmpl_str, bool keep_restricted, string& error)
|
||||
{
|
||||
Template * new_tmpl = get_new_template();
|
||||
|
||||
@@ -209,6 +224,11 @@ int PoolObjectSQL::append_template(const string& tmpl_str, string& error)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (keep_restricted)
|
||||
{
|
||||
new_tmpl->remove_restricted();
|
||||
}
|
||||
|
||||
if ( obj_template != 0 )
|
||||
{
|
||||
obj_template->merge(new_tmpl, error);
|
||||
|
||||
Reference in new issue
Block a user