#ifdef _WIN32
return command;
#else /* _WIN32 */
- args.push_back("sh");
- args.push_back("-c");
- args.push_back(command);
- return args;
+ return { "sh", "-c", command };
#endif
}
/* write zones.conf and update with zone + endpoint information */
Log(LogInformation, "cli", "Generating zone and object configuration.");
- std::vector<String> globalZones;
-
- globalZones.push_back("global-templates");
- globalZones.push_back("director-global");
-
- NodeUtility::GenerateNodeMasterIcingaConfig(globalZones);
+ NodeUtility::GenerateNodeMasterIcingaConfig({ "global-templates", "director-global" });
/* update the ApiListener config - SetupMaster() will always enable it */
Log(LogInformation, "cli", "Updating the APIListener feature.");
/* disable the notifications feature */
Log(LogInformation, "cli", "Disabling the Notification feature.");
- std::vector<std::string> disable;
- disable.push_back("notification");
- FeatureUtility::DisableFeatures(disable);
+ FeatureUtility::DisableFeatures({ "notification" });
/* enable the ApiListener config */
Log(LogInformation, "cli", "Updating the ApiListener feature.");
- std::vector<std::string> enable;
- enable.push_back("api");
- FeatureUtility::EnableFeatures(enable);
+ FeatureUtility::EnableFeatures({ "api" });
String apipath = FeatureUtility::GetFeaturesAvailablePath() + "/api.conf";
NodeUtility::CreateBackupFile(apipath);
Log(LogInformation, "cli", "Generating zone and object configuration.");
- std::vector<String> globalZones;
-
- globalZones.push_back("global-templates");
- globalZones.push_back("director-global");
-
- NodeUtility::GenerateNodeIcingaConfig(vm["endpoint"].as<std::vector<std::string> >(), globalZones);
+ NodeUtility::GenerateNodeIcingaConfig(vm["endpoint"].as<std::vector<std::string> >(), { "global-templates", "director-global" });
/* update constants.conf with NodeName = CN */
if (cn != Utility::GetFQDN()) {
/* disable the notifications feature on client nodes */
Log(LogInformation, "cli", "Disabling the Notification feature.");
- std::vector<std::string> disable;
- disable.push_back("notification");
- FeatureUtility::DisableFeatures(disable);
+ FeatureUtility::DisableFeatures({ "notification" });
Log(LogInformation, "cli", "Enabling the ApiListener feature.");
- std::vector<std::string> enable;
- enable.push_back("api");
- FeatureUtility::EnableFeatures(enable);
+ FeatureUtility::EnableFeatures({ "api" });
String apiConfPath = FeatureUtility::GetFeaturesAvailablePath() + "/api.conf";
NodeUtility::CreateBackupFile(apiConfPath);
/* apilistener config */
Log(LogInformation, "cli", "Generating local zones.conf.");
- std::vector<String> globalZones;
-
- globalZones.push_back("global-templates");
- globalZones.push_back("director-global");
-
- NodeUtility::GenerateNodeIcingaConfig(endpoints, globalZones);
+ NodeUtility::GenerateNodeIcingaConfig(endpoints, { "global-templates", "director-global" });
if (cn != Utility::GetFQDN()) {
Log(LogWarning, "cli")
else
std::cout << "'api' feature already enabled.\n";
- std::vector<String> globalZones;
-
- globalZones.push_back("global-templates");
- globalZones.push_back("director-global");
-
- NodeUtility::GenerateNodeMasterIcingaConfig(globalZones);
+ NodeUtility::GenerateNodeMasterIcingaConfig({ "global-templates", "director-global" });
/* apilistener config */
std::cout << ConsoleColorTag(Console_Bold)
using namespace icinga;
INITIALIZE_ONCE([]() {
- std::vector<String> targets;
- targets.push_back("Host");
- targets.push_back("Service");
- ApplyRule::RegisterType("Dependency", targets);
+ ApplyRule::RegisterType("Dependency", { "Host", "Service" });
});
bool Dependency::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule)
using namespace icinga;
INITIALIZE_ONCE([]() {
- std::vector<String> targets;
- targets.push_back("Host");
- targets.push_back("Service");
- ApplyRule::RegisterType("Notification", targets);
+ ApplyRule::RegisterType("Notification", { "Host", "Service" });
});
bool Notification::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule)
using namespace icinga;
INITIALIZE_ONCE([]() {
- std::vector<String> targets;
- targets.push_back("Host");
- targets.push_back("Service");
- ApplyRule::RegisterType("ScheduledDowntime", targets);
+ ApplyRule::RegisterType("ScheduledDowntime", { "Host", "Service" });
});
bool ScheduledDowntime::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule)
using namespace icinga;
INITIALIZE_ONCE([]() {
- std::vector<String> targets;
- targets.push_back("Host");
- ApplyRule::RegisterType("Service", targets);
+ ApplyRule::RegisterType("Service", { "Host" });
});
bool Service::EvaluateApplyRuleInstance(const Host::Ptr& host, const String& name, ScriptFrame& frame, const ApplyRule& rule)
url->SetScheme("https");
url->SetHost(m_Connection->GetHost());
url->SetPort(m_Connection->GetPort());
-
- std::vector<String> path;
- path.push_back("v1");
- path.push_back("types");
- url->SetPath(path);
+ url->SetPath({ "v1", "types" });
try {
std::shared_ptr<HttpRequest> req = m_Connection->NewRequest();
url->SetScheme("https");
url->SetHost(m_Connection->GetHost());
url->SetPort(m_Connection->GetPort());
-
- std::vector<String> path;
- path.push_back("v1");
- path.push_back("objects");
- path.push_back(pluralType);
- url->SetPath(path);
+ url->SetPath({ "v1", "objects", pluralType });
std::map<String, std::vector<String> > params;
url->SetScheme("https");
url->SetHost(m_Connection->GetHost());
url->SetPort(m_Connection->GetPort());
-
- std::vector<String> path;
- path.push_back("v1");
- path.push_back("console");
- path.push_back("execute-script");
- url->SetPath(path);
+ url->SetPath({ "v1", "console", "execute-script" });
std::map<String, std::vector<String> > params;
params["session"].push_back(session);
url->SetScheme("https");
url->SetHost(m_Connection->GetHost());
url->SetPort(m_Connection->GetPort());
-
- std::vector<String> path;
- path.push_back("v1");
- path.push_back("console");
- path.push_back("auto-complete-script");
- url->SetPath(path);
+ url->SetPath({ "v1", "console", "auto-complete-script" });
std::map<String, std::vector<String> > params;
params["session"].push_back(session);