mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-14 16:53:12 +09:00
Feature #2124: New template append action in core
This commit is contained in:
1 parent
7dda3a27fc
commit
c632828876
6 files changed
+155
-4
No files matched your search
@@ -196,6 +196,38 @@ int PoolObjectSQL::replace_template(const string& tmpl_str, string& error)
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int PoolObjectSQL::append_template(const string& tmpl_str, string& error)
|
||||
{
|
||||
Template * new_tmpl = get_new_template();
|
||||
|
||||
if ( new_tmpl == 0 )
|
||||
{
|
||||
error = "Cannot allocate a new template";
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( new_tmpl->parse_str_or_xml(tmpl_str, error) != 0 )
|
||||
{
|
||||
delete new_tmpl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( obj_template != 0 )
|
||||
{
|
||||
obj_template->merge(new_tmpl, error);
|
||||
delete new_tmpl;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj_template = new_tmpl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
string& PoolObjectSQL::perms_to_xml(string& xml) const
|
||||
{
|
||||
ostringstream oss;
|
||||
|
||||
Reference in new issue
Block a user