mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 05:34:48 +02:00
parent
58f923f5f7
commit
a43cf8e9ef
@ -270,8 +270,9 @@ void NodeUtility::SerializeObject(std::ostream& fp, const Dictionary::Ptr& objec
|
|||||||
* include = true, will add an include statement or uncomment a statement if one is existing
|
* include = true, will add an include statement or uncomment a statement if one is existing
|
||||||
* resursive = false, will search for a non-resursive include statement
|
* resursive = false, will search for a non-resursive include statement
|
||||||
* recursive = true, will search for a resursive include statement
|
* recursive = true, will search for a resursive include statement
|
||||||
|
* Returns true on success, false if option was not found
|
||||||
*/
|
*/
|
||||||
void NodeUtility::UpdateConfiguration(const String& value, const bool& include, const bool& recursive)
|
bool NodeUtility::UpdateConfiguration(const String& value, const bool& include, const bool& recursive)
|
||||||
{
|
{
|
||||||
String configurationFile = Application::GetSysconfDir() + "/icinga2/icinga2.conf";
|
String configurationFile = Application::GetSysconfDir() + "/icinga2/icinga2.conf";
|
||||||
|
|
||||||
@ -331,6 +332,8 @@ void NodeUtility::UpdateConfiguration(const String& value, const bool& include,
|
|||||||
<< boost::errinfo_errno(errno)
|
<< boost::errinfo_errno(errno)
|
||||||
<< boost::errinfo_file_name(configurationFile));
|
<< boost::errinfo_file_name(configurationFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return (found || include);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeUtility::UpdateConstant(const String& name, const String& value)
|
void NodeUtility::UpdateConstant(const String& name, const String& value)
|
||||||
|
@ -44,7 +44,7 @@ public:
|
|||||||
|
|
||||||
static bool WriteNodeConfigObjects(const String& filename, const Array::Ptr& objects);
|
static bool WriteNodeConfigObjects(const String& filename, const Array::Ptr& objects);
|
||||||
|
|
||||||
static void UpdateConfiguration(const String& value, const bool& include, const bool& recursive);
|
static bool UpdateConfiguration(const String& value, const bool& include, const bool& recursive);
|
||||||
static void UpdateConstant(const String& name, const String& value);
|
static void UpdateConstant(const String& name, const String& value);
|
||||||
|
|
||||||
/* node setup helpers */
|
/* node setup helpers */
|
||||||
|
@ -631,7 +631,12 @@ wizard_global_zone_loop_start:
|
|||||||
<< "Disable the inclusion of the conf.d directory...\n"
|
<< "Disable the inclusion of the conf.d directory...\n"
|
||||||
<< ConsoleColorTag(Console_Normal);
|
<< ConsoleColorTag(Console_Normal);
|
||||||
|
|
||||||
NodeUtility::UpdateConfiguration("\"conf.d\"", false, true);
|
if(!NodeUtility::UpdateConfiguration("\"conf.d\"", false, true)) {
|
||||||
|
std::cout << ConsoleColorTag(Console_Bold | Console_ForegroundRed)
|
||||||
|
<< "Failed to disable conf.d inclusion, it may already be disabled."
|
||||||
|
<< ConsoleColorTag(Console_Normal);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user