Replace spaces with tabs

refs #7250
This commit is contained in:
Gunnar Beutner 2014-10-15 08:45:58 +02:00
parent 39116e4906
commit ce6f7ace89
5 changed files with 44 additions and 44 deletions

View File

@ -56,14 +56,14 @@ public:
static void Unregister(const std::vector<String>& name); static void Unregister(const std::vector<String>& name);
static bool ParseCommand(int argc, char **argv, boost::program_options::options_description& visibleDesc, static bool ParseCommand(int argc, char **argv, boost::program_options::options_description& visibleDesc,
boost::program_options::options_description& hiddenDesc, boost::program_options::options_description& hiddenDesc,
boost::program_options::positional_options_description& positionalDesc, boost::program_options::positional_options_description& positionalDesc,
ArgumentCompletionDescription& argCompletionDesc, ArgumentCompletionDescription& argCompletionDesc,
boost::program_options::variables_map& vm, String& cmdname, boost::program_options::variables_map& vm, String& cmdname,
CLICommand::Ptr& command, bool autocomplete); CLICommand::Ptr& command, bool autocomplete);
static void ShowCommands(int argc, char **argv, static void ShowCommands(int argc, char **argv,
boost::program_options::options_description *visibleDesc = NULL, boost::program_options::options_description *visibleDesc = NULL,
boost::program_options::options_description *hiddenDesc = NULL, boost::program_options::options_description *hiddenDesc = NULL,
ArgumentCompletionDescription *argCompletionDesc = NULL, ArgumentCompletionDescription *argCompletionDesc = NULL,
bool autocomplete = false, int autoindex = -1); bool autocomplete = false, int autoindex = -1);

View File

@ -48,7 +48,7 @@ void FeatureDisableCommand::InitParameters(boost::program_options::options_descr
boost::program_options::options_description& hiddenDesc, boost::program_options::options_description& hiddenDesc,
ArgumentCompletionDescription& argCompletionDesc) const ArgumentCompletionDescription& argCompletionDesc) const
{ {
/* Command doesn't support any parameters. */ /* Command doesn't support any parameters. */
} }
/** /**
@ -60,46 +60,46 @@ int FeatureDisableCommand::Run(const boost::program_options::variables_map& vm,
{ {
#ifdef _WIN32 #ifdef _WIN32
//TODO: Add Windows support //TODO: Add Windows support
Log(LogInformation, "cli", "This command is not available on Windows."); Log(LogInformation, "cli", "This command is not available on Windows.");
#else #else
String features_enabled_dir = Application::GetSysconfDir() + "/icinga2/features-enabled"; String features_enabled_dir = Application::GetSysconfDir() + "/icinga2/features-enabled";
if (ap.empty()) { if (ap.empty()) {
Log(LogCritical, "cli", "Cannot disable feature(s). Name(s) are missing!"); Log(LogCritical, "cli", "Cannot disable feature(s). Name(s) are missing!");
return 0; return 0;
} }
if (!Utility::PathExists(features_enabled_dir) ) { if (!Utility::PathExists(features_enabled_dir) ) {
Log(LogCritical, "cli", "Cannot disable features. Path '" + features_enabled_dir + "' does not exist."); Log(LogCritical, "cli", "Cannot disable features. Path '" + features_enabled_dir + "' does not exist.");
return 0; return 0;
} }
std::vector<std::string> errors; std::vector<std::string> errors;
BOOST_FOREACH(const String& feature, ap) { BOOST_FOREACH(const String& feature, ap) {
String target = features_enabled_dir + "/" + feature + ".conf"; String target = features_enabled_dir + "/" + feature + ".conf";
if (!Utility::PathExists(target) ) { if (!Utility::PathExists(target) ) {
Log(LogCritical, "cli", "Cannot disable feature '" + feature + "'. Target file '" + target + "' does not exist."); Log(LogCritical, "cli", "Cannot disable feature '" + feature + "'. Target file '" + target + "' does not exist.");
errors.push_back(feature); errors.push_back(feature);
continue; continue;
}
if (unlink(target.CStr()) < 0) {
Log(LogCritical, "cli", "Cannot disable feature '" + feature + "'. Unlinking target file '" + target +
"' failed with error code " + Convert::ToString(errno) + ", \"" + Utility::FormatErrorNumber(errno) + "\".");
errors.push_back(feature);
continue;
} }
Log(LogInformation, "cli", "Disabling feature " + feature + " in '" + features_enabled_dir + "'."); if (unlink(target.CStr()) < 0) {
} Log(LogCritical, "cli", "Cannot disable feature '" + feature + "'. Unlinking target file '" + target +
"' failed with error code " + Convert::ToString(errno) + ", \"" + Utility::FormatErrorNumber(errno) + "\".");
errors.push_back(feature);
continue;
}
if (!errors.empty()) { Log(LogInformation, "cli", "Disabling feature " + feature + " in '" + features_enabled_dir + "'.");
Log(LogCritical, "cli", "Cannot disable feature(s): " + boost::algorithm::join(errors, " ")); }
if (!errors.empty()) {
Log(LogCritical, "cli", "Cannot disable feature(s): " + boost::algorithm::join(errors, " "));
errors.clear(); errors.clear();
return 1; return 1;
} }
#endif /* _WIN32 */ #endif /* _WIN32 */

View File

@ -48,7 +48,7 @@ void FeatureEnableCommand::InitParameters(boost::program_options::options_descri
boost::program_options::options_description& hiddenDesc, boost::program_options::options_description& hiddenDesc,
ArgumentCompletionDescription& argCompletionDesc) const ArgumentCompletionDescription& argCompletionDesc) const
{ {
/* Command doesn't support any parameters. */ /* Command doesn't support any parameters. */
} }
/** /**

View File

@ -48,7 +48,7 @@ void FeatureListCommand::InitParameters(boost::program_options::options_descript
boost::program_options::options_description& hiddenDesc, boost::program_options::options_description& hiddenDesc,
ArgumentCompletionDescription& argCompletionDesc) const ArgumentCompletionDescription& argCompletionDesc) const
{ {
/* Command doesn't support any parameters. */ /* Command doesn't support any parameters. */
} }
/** /**
@ -58,13 +58,13 @@ void FeatureListCommand::InitParameters(boost::program_options::options_descript
*/ */
int FeatureListCommand::Run(const boost::program_options::variables_map& vm, const std::vector<std::string>& ap) const int FeatureListCommand::Run(const boost::program_options::variables_map& vm, const std::vector<std::string>& ap) const
{ {
if (!ap.empty()) { if (!ap.empty()) {
Log(LogWarning, "cli", "Ignoring parameters: " + boost::algorithm::join(ap, " ")); Log(LogWarning, "cli", "Ignoring parameters: " + boost::algorithm::join(ap, " "));
} }
#ifdef _WIN32 #ifdef _WIN32
//TODO: Add Windows support //TODO: Add Windows support
Log(LogInformation, "cli", "This command is not available on Windows."); Log(LogInformation, "cli", "This command is not available on Windows.");
#else #else
std::vector<String> enabled_features; std::vector<String> enabled_features;
std::vector<String> available_features; std::vector<String> available_features;

View File

@ -44,7 +44,7 @@ public:
virtual int Run(const boost::program_options::variables_map& vm, const std::vector<std::string>& ap) const; virtual int Run(const boost::program_options::variables_map& vm, const std::vector<std::string>& ap) const;
private: private:
static void CollectFeatures(const String& feature_file, std::vector<String>& features); static void CollectFeatures(const String& feature_file, std::vector<String>& features);
}; };