F #1512: Do not overwrite attributes already defined in the image

This commit is contained in:
juanmont authored and Ruben S. Montero committed 2017-11-28 15:18:38 +01:00
1 parent 5ed8aaa47b
commit 22e06f49e0
1 file changed
+5 -5
+5 -5
View File
@@ -118,14 +118,14 @@ void Datastore::disk_attribute(
get_template_attribute("CLONE_TARGET", st);
if(!st.empty())
if(!st.empty() && disk->vector_value("CLONE_TARGET").empty())
{
disk->replace("CLONE_TARGET", st);
}
get_template_attribute("LN_TARGET", st);
if(!st.empty())
if(!st.empty() && disk->vector_value("LN_TARGET").empty())
{
disk->replace("LN_TARGET", st);
}
@@ -135,13 +135,13 @@ void Datastore::disk_attribute(
current_val = disk->vector_value((*it).c_str());
get_template_attribute((*it).c_str(), inherit_val);
if ( current_val.empty() && !inherit_val.empty() )
if ( current_val.empty() && !inherit_val.empty() && disk->vector_value((*it).c_str()).empty())
{
disk->replace(*it, inherit_val);
}
}
if (disk->is_volatile())
if (disk->is_volatile() && disk->vector_value("DISK_TYPE").empty())
{
disk->replace("DISK_TYPE", Image::disk_type_to_str(get_disk_type()));
}
@@ -152,7 +152,7 @@ void Datastore::disk_attribute(
{
get_template_attribute("DRIVER", st);
if(!st.empty())
if(!st.empty() && disk->vector_value("DRIVER").empty())
{
disk->replace("DRIVER", st);
}