Fix crash in node update-config

fixes #8182
This commit is contained in:
Michael Friedrich 2015-01-09 14:10:48 +01:00
parent 844defd362
commit 123f7fd552

View File

@ -115,6 +115,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
Dictionary::Ptr old_node = old_node_objs.second;
Dictionary::Ptr old_node_repository = old_node->Get("repository");
if (old_node_repository) {
ObjectLock olock(old_node_repository);
BOOST_FOREACH(const Dictionary::Pair& kv, old_node_repository) {
String host = kv.first;
@ -123,6 +124,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
host_attrs->Set("name", host);
RepositoryUtility::RemoveObject(host, "Host", host_attrs); //this removes all services for this host as well
}
}
String zone = old_node->Get("zone");
String endpoint = old_node->Get("endpoint");
@ -142,6 +144,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
Dictionary::Ptr old_node = old_node_objs.second;
Dictionary::Ptr old_node_repository = old_node->Get("repository");
if (old_node_repository) {
ObjectLock xlock(old_node_repository);
BOOST_FOREACH(const Dictionary::Pair& kv, old_node_repository) {
String old_host = kv.first;
@ -199,6 +202,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
}
}
}
}
/* next iterate over all nodes and add hosts/services */
BOOST_FOREACH(const Dictionary::Ptr& node, nodes) {