mirror of https://github.com/Icinga/icinga2.git
parent
8b941a8db5
commit
14a5be30e0
|
@ -197,30 +197,16 @@ int FeatureUtility::ListFeatures(std::ostream& os)
|
||||||
|
|
||||||
bool FeatureUtility::GetFeatures(std::vector<String>& features, bool get_disabled)
|
bool FeatureUtility::GetFeatures(std::vector<String>& features, bool get_disabled)
|
||||||
{
|
{
|
||||||
String path;
|
|
||||||
|
|
||||||
/* request all disabled features */
|
/* request all disabled features */
|
||||||
if (get_disabled) {
|
if (get_disabled) {
|
||||||
/* disable = available-enabled */
|
/* disable = available-enabled */
|
||||||
String available_pattern = GetFeaturesAvailablePath() + "/*.conf";
|
String available_pattern = GetFeaturesAvailablePath() + "/*.conf";
|
||||||
std::vector<String> available;
|
std::vector<String> available;
|
||||||
|
Utility::Glob(available_pattern, boost::bind(&FeatureUtility::CollectFeatures, _1, boost::ref(available)), GlobFile);
|
||||||
if (!Utility::Glob(available_pattern,
|
|
||||||
boost::bind(&FeatureUtility::CollectFeatures, _1, boost::ref(available)), GlobFile)) {
|
|
||||||
Log(LogCritical, "cli")
|
|
||||||
<< "Cannot access path '" << path << "'.";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
String enabled_pattern = GetFeaturesEnabledPath() + "/*.conf";
|
String enabled_pattern = GetFeaturesEnabledPath() + "/*.conf";
|
||||||
std::vector<String> enabled;
|
std::vector<String> enabled;
|
||||||
|
Utility::Glob(enabled_pattern, boost::bind(&FeatureUtility::CollectFeatures, _1, boost::ref(enabled)), GlobFile);
|
||||||
if (!Utility::Glob(enabled_pattern,
|
|
||||||
boost::bind(&FeatureUtility::CollectFeatures, _1, boost::ref(enabled)), GlobFile)) {
|
|
||||||
Log(LogCritical, "cli")
|
|
||||||
<< "Cannot access path '" << path << "'.";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::sort(available.begin(), available.end());
|
std::sort(available.begin(), available.end());
|
||||||
std::sort(enabled.begin(), enabled.end());
|
std::sort(enabled.begin(), enabled.end());
|
||||||
|
@ -233,12 +219,7 @@ bool FeatureUtility::GetFeatures(std::vector<String>& features, bool get_disable
|
||||||
/* all enabled features */
|
/* all enabled features */
|
||||||
String enabled_pattern = GetFeaturesEnabledPath() + "/*.conf";
|
String enabled_pattern = GetFeaturesEnabledPath() + "/*.conf";
|
||||||
|
|
||||||
if (!Utility::Glob(enabled_pattern,
|
Utility::Glob(enabled_pattern, boost::bind(&FeatureUtility::CollectFeatures, _1, boost::ref(features)), GlobFile);
|
||||||
boost::bind(&FeatureUtility::CollectFeatures, _1, boost::ref(features)), GlobFile)) {
|
|
||||||
Log(LogCritical, "cli")
|
|
||||||
<< "Cannot access path '" << path << "'.";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue