From 22e06f49e0af06d9c63f2e515d2e498ee413cb54 Mon Sep 17 00:00:00 2001 From: juanmont Date: Tue, 28 Nov 2017 15:18:38 +0100 Subject: [PATCH] F #1512: Do not overwrite attributes already defined in the image --- src/datastore/Datastore.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/datastore/Datastore.cc b/src/datastore/Datastore.cc index def084789a..0ca47e9f9f 100644 --- a/src/datastore/Datastore.cc +++ b/src/datastore/Datastore.cc @@ -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); }