Cli: Don't parse node repository files twice in 'node update-config'

refs #7917
This commit is contained in:
Michael Friedrich 2014-12-11 14:47:46 +01:00
parent 622bb6f012
commit ebc0845853
1 changed files with 3 additions and 2 deletions

View File

@ -87,9 +87,10 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
Utility::LoadExtensionLibrary("icinga");
std::vector<String> object_paths = RepositoryUtility::GetObjects();
std::vector<Dictionary::Ptr> nodes = NodeUtility::GetNodes();
/* first make sure that all nodes are valid and should not be removed */
BOOST_FOREACH(const Dictionary::Ptr& node, NodeUtility::GetNodes()) {
BOOST_FOREACH(const Dictionary::Ptr& node, nodes) {
Dictionary::Ptr repository = node->Get("repository");
String zone = node->Get("zone");
String endpoint = node->Get("endpoint");
@ -201,7 +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, NodeUtility::GetNodes()) {
BOOST_FOREACH(const Dictionary::Ptr& node, nodes) {
Dictionary::Ptr repository = node->Get("repository");
String zone = node->Get("zone");
String endpoint = node->Get("endpoint");