mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-23 17:33:56 +03:00
parent
1fd5b1059d
commit
7484ed9008
@ -47,9 +47,13 @@ public:
|
||||
/**
|
||||
* Replace template for this object. Object should be updated
|
||||
* after calling this method
|
||||
* @param tmpl string representation of the template
|
||||
* @param tmpl_str new contents
|
||||
* @param keep_restricted If true, the restricted attributes of the
|
||||
* current template will override the new template
|
||||
* @param error string describing the error if any
|
||||
* @return 0 on success
|
||||
*/
|
||||
int replace_template(const string& tmpl_str, string& error);
|
||||
int replace_template(const string& tmpl_str, bool keep_restricted, string& error);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -251,7 +251,7 @@ int Zone::from_xml(const string& xml)
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
int Zone::replace_template(const string& tmpl_str, string& error_str)
|
||||
int Zone::replace_template(const string& tmpl_str, bool keep_restricted, string& error_str)
|
||||
{
|
||||
Template * new_tmpl = get_new_template();
|
||||
|
||||
@ -267,6 +267,19 @@ int Zone::replace_template(const string& tmpl_str, string& error_str)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
string new_endpoint;
|
||||
new_tmpl->get("ENDPOINT", new_endpoint);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user