Commit 6bb901dc authored by Sergey Kipnis's avatar Sergey Kipnis
Browse files

Add integration mode to command line

CMK-3963

Change-Id: I56600eef63bf6b7ab99dcf8e4cf0d9cdd5f59f6e
parent 4c1faf02
......@@ -500,13 +500,24 @@ int MainFunction(int argc, wchar_t const *argv[]) {
if (param == wtools::ConvertToUTF16(kExecParam) ||
param == wtools::ConvertToUTF16(kAdhocParam)) {
std::wstring second_param = argc > 2 ? argv[2] : L"";
std::wstring second_param{argc > 2 ? argv[2] : L""};
auto log_on_screen = srv::StdioLog::no;
if (second_param == wtools::ConvertToUTF16(kExecParamShowAll))
if (second_param == wtools::ConvertToUTF16(kExecParamShowAll)) {
log_on_screen = srv::StdioLog::extended;
else if (second_param == wtools::ConvertToUTF16(kExecParamShowWarn))
} else if (second_param == wtools::ConvertToUTF16(kExecParamShowWarn)) {
log_on_screen = srv::StdioLog::yes;
} else if (second_param ==
wtools::ConvertToUTF16(kExecParamIntegration)) {
if (cma::tools::win::GetEnv(env::integration_base_dir).empty()) {
fmt::print(
L"Integration is requested, but env var '{}' is absent\n",
env::integration_base_dir);
::exit(12);
} else {
cma::details::SetModus(cma::Modus::integration);
}
}
return srv::ExecMainService(log_on_screen);
}
......
......@@ -43,10 +43,11 @@ constexpr std::string_view kExecParam = "exec"; // runs as app
constexpr std::string_view kAdhocParam = "adhoc"; // runs as app
constexpr std::string_view kExecParamShowWarn = "-show"; // logging sub param
constexpr std::string_view kExecParamShowAll = "-showall"; // logging sub param
constexpr std::string_view kExecParamIntegration = "-integration"; // internal
constexpr std::string_view kCvtParam = "convert"; // convert ini to yaml
constexpr std::string_view kCvtParamShow = "-show"; // logging sub param
constexpr const wchar_t* kSkypeParam = L"skype"; // hidden
constexpr const wchar_t *kSkypeParam = L"skype"; // hidden
constexpr std::string_view kPatchHashParam = "patch_hash"; // hidden
constexpr std::string_view kStopLegacyParam = "stop_legacy"; //
constexpr std::string_view kStartLegacyParam = "start_legacy"; //
......@@ -72,9 +73,9 @@ constexpr std::string_view kResetOhm = "resetohm"; // reset ohm as treasury
// Service name and Targeting
#if defined(CMK_SERVICE_NAME)
constexpr const char* const kServiceExeName = "check_mk_agent.exe";
constexpr const char *const kServiceExeName = "check_mk_agent.exe";
#elif defined(CMK_TEST)
constexpr const char* const kServiceExeName = L"test";
constexpr const char *const kServiceExeName = L"test";
#else
#error "Target not defined properly"
#endif
......@@ -82,6 +83,6 @@ constexpr const char* const kServiceExeName = L"test";
} // namespace cma::cmdline
namespace cma {
// we want to test main function too.
int MainFunction(int argc, wchar_t const* Argv[]);
int MainFunction(int argc, wchar_t const *argv[]);
} // namespace cma
#endif // check_mk_service_h__
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment