]> granicus.if.org Git - icinga2/commitdiff
Make sure that "feature enable" uses relative paths for the symlinks
authorGunnar Beutner <gunnar@beutner.name>
Sat, 20 Dec 2014 07:39:12 +0000 (08:39 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Sat, 20 Dec 2014 07:39:12 +0000 (08:39 +0100)
fixes #8121

lib/cli/featureutility.cpp

index 6f487b421c3ec727ffd648d420eacceac94fda7c..de3577309f02e6a5671aaa4c1416a837ddc08e0e 100644 (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";
 
 #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")
-                           << "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) << "\".";
                        errors.push_back(feature);
                        continue;