Make sure that "feature enable" uses relative paths for the symlinks

fixes #8121
This commit is contained in:
Gunnar Beutner 2014-12-20 08:39:12 +01:00
parent 6c53c7f192
commit 3e64b642ca
1 changed files with 4 additions and 2 deletions

View File

@ -97,9 +97,11 @@ int FeatureUtility::EnableFeatures(const std::vector<std::string>& features)
<< ConsoleColorTag(Console_Normal) << ". Make sure to restart Icinga 2 for these changes to take effect.\n"; << ConsoleColorTag(Console_Normal) << ". Make sure to restart Icinga 2 for these changes to take effect.\n";
#ifndef _WIN32 #ifndef _WIN32
if (symlink(source.CStr(), target.CStr()) < 0) { String relativeSource = "../features-available/" + feature + ".conf";
if (symlink(relativeSource.CStr(), target.CStr()) < 0) {
Log(LogCritical, "cli") Log(LogCritical, "cli")
<< "Cannot enable feature '" << feature << "'. Linking source '" << source << "' to target file '" << target << "Cannot enable feature '" << feature << "'. Linking source '" << relativeSource << "' to target file '" << target
<< "' failed with error code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\"."; << "' failed with error code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\".";
errors.push_back(feature); errors.push_back(feature);
continue; continue;