Cli: Fix 'repository host remove' for hosts w/o services

refs #7255
This commit is contained in:
Michael Friedrich 2014-10-28 15:23:51 +01:00
parent 29ad90a469
commit ab5a55d754
1 changed files with 9 additions and 0 deletions

View File

@ -350,10 +350,19 @@ bool RepositoryUtility::RemoveObjectInternal(const String& name, const String& t
if (type == "Host") {
path = GetRepositoryObjectConfigPath(type, attrs) + "/" + name;
/* if path does not exist, this host does not have any services */
if (!Utility::PathExists(path)) {
Log(LogNotice, "cli")
<< type << " '" << name << "' does not have any services configured.";
return success;
}
std::vector<String> files;
Utility::GlobRecursive(path, "*.conf",
boost::bind(&RepositoryUtility::CollectObjects, _1, boost::ref(files)), GlobFile);
BOOST_FOREACH(const String& file, files) {
RemoveObjectFileInternal(file);
}