mirror of https://github.com/Icinga/icinga2.git
parent
5bbc8cacbd
commit
f1a1dfb26e
|
@ -502,9 +502,8 @@ static String UnameHelper(char type)
|
|||
pclose(fp);
|
||||
|
||||
String result = msgbuf.str();
|
||||
result.Trim();
|
||||
|
||||
return result;
|
||||
return result.Trim();
|
||||
}
|
||||
|
||||
int ReleaseHelper(std::string &result)
|
||||
|
|
|
@ -271,23 +271,20 @@ int NodeUtility::GenerateNodeIcingaConfig(const std::vector<std::string>& endpoi
|
|||
Dictionary::Ptr my_master_endpoint = new Dictionary();
|
||||
|
||||
if (tokens.size() > 1) {
|
||||
String host = tokens[1];
|
||||
host.Trim();
|
||||
String host = tokens[1].Trim();
|
||||
|
||||
if (!host.IsEmpty())
|
||||
my_master_endpoint->Set("host", host);
|
||||
}
|
||||
|
||||
if (tokens.size() > 2) {
|
||||
String port = tokens[2];
|
||||
port.Trim();
|
||||
String port = tokens[2].Trim();
|
||||
|
||||
if (!port.IsEmpty())
|
||||
my_master_endpoint->Set("port", port);
|
||||
}
|
||||
|
||||
String cn = tokens[0];
|
||||
cn.Trim();
|
||||
String cn = tokens[0].Trim();
|
||||
my_master_endpoint->Set("__name", cn);
|
||||
my_master_endpoint->Set("__type", "Endpoint");
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ int NodeWizardCommand::Run(const boost::program_options::variables_map& vm, cons
|
|||
answer = Utility::GetFQDN();
|
||||
|
||||
String cn = answer;
|
||||
cn.Trim();
|
||||
cn = cn.Trim();
|
||||
|
||||
std::cout << ConsoleColorTag(Console_Bold) << "Please specifiy the local zone name" << ConsoleColorTag(Console_Normal) << " [" << cn << "]: ";
|
||||
|
||||
|
@ -137,7 +137,7 @@ int NodeWizardCommand::Run(const boost::program_options::variables_map& vm, cons
|
|||
answer = cn;
|
||||
|
||||
String local_zone = answer;
|
||||
local_zone.Trim();
|
||||
local_zone = local_zone.Trim();
|
||||
|
||||
std::vector<std::string> endpoints;
|
||||
|
||||
|
@ -159,7 +159,7 @@ wizard_endpoint_loop_start:
|
|||
}
|
||||
|
||||
endpoint_buffer = answer;
|
||||
endpoint_buffer.Trim();
|
||||
endpoint_buffer = endpoint_buffer.Trim();
|
||||
|
||||
std::cout << "Do you want to establish a connection to the master " << ConsoleColorTag(Console_Bold) << "from this node?" << ConsoleColorTag(Console_Normal) << " [Y/n]: ";
|
||||
|
||||
|
@ -183,7 +183,8 @@ wizard_endpoint_loop_start:
|
|||
}
|
||||
|
||||
String tmp = answer;
|
||||
tmp.Trim();
|
||||
tmp = tmp.Trim();
|
||||
|
||||
endpoint_buffer += "," + tmp;
|
||||
master_endpoint_name = tmp; //store the endpoint name for later
|
||||
|
||||
|
@ -197,8 +198,7 @@ wizard_endpoint_loop_start:
|
|||
else
|
||||
tmp = "5665";
|
||||
|
||||
tmp.Trim();
|
||||
endpoint_buffer += "," + tmp;
|
||||
endpoint_buffer += "," + tmp.Trim();
|
||||
}
|
||||
|
||||
endpoints.push_back(endpoint_buffer);
|
||||
|
@ -228,7 +228,7 @@ wizard_master_host:
|
|||
goto wizard_master_host;
|
||||
|
||||
String master_host = answer;
|
||||
master_host.Trim();
|
||||
master_host = master_host.Trim();
|
||||
|
||||
std::cout << ConsoleColorTag(Console_Bold) << "Port" << ConsoleColorTag(Console_Normal) << " [5665]: ";
|
||||
|
||||
|
@ -239,7 +239,7 @@ wizard_master_host:
|
|||
answer = "5665";
|
||||
|
||||
String master_port = answer;
|
||||
master_port.Trim();
|
||||
master_port = master_port.Trim();
|
||||
|
||||
/* workaround for fetching the master cert */
|
||||
String pki_path = PkiUtility::GetPkiPath();
|
||||
|
@ -306,7 +306,7 @@ wizard_ticket:
|
|||
goto wizard_ticket;
|
||||
|
||||
String ticket = answer;
|
||||
ticket.Trim();
|
||||
ticket = ticket.Trim();
|
||||
|
||||
Log(LogInformation, "cli")
|
||||
<< "Processing self-signed certificate request. Ticket '" << ticket << "'.\n";
|
||||
|
@ -339,7 +339,7 @@ wizard_ticket:
|
|||
boost::algorithm::to_lower(answer);
|
||||
|
||||
String bind_host = answer;
|
||||
bind_host.Trim();
|
||||
bind_host = bind_host.Trim();
|
||||
|
||||
std::cout << "Bind Port []: ";
|
||||
|
||||
|
@ -347,7 +347,7 @@ wizard_ticket:
|
|||
boost::algorithm::to_lower(answer);
|
||||
|
||||
String bind_port = answer;
|
||||
bind_port.Trim();
|
||||
bind_port = bind_port.Trim();
|
||||
|
||||
std::cout << ConsoleColorTag(Console_Bold) << "Accept config from master?" << ConsoleColorTag(Console_Normal) << " [y/N]: ";
|
||||
std::getline(std::cin, answer);
|
||||
|
@ -449,7 +449,7 @@ wizard_ticket:
|
|||
answer = Utility::GetFQDN();
|
||||
|
||||
String cn = answer;
|
||||
cn.Trim();
|
||||
cn = cn.Trim();
|
||||
|
||||
/* check whether the user wants to generate a new certificate or not */
|
||||
String existing_path = PkiUtility::GetPkiPath() + "/" + cn + ".crt";
|
||||
|
@ -481,7 +481,7 @@ wizard_ticket:
|
|||
boost::algorithm::to_lower(answer);
|
||||
|
||||
String bind_host = answer;
|
||||
bind_host.Trim();
|
||||
bind_host = bind_host.Trim();
|
||||
|
||||
std::cout << ConsoleColorTag(Console_Bold) << "Bind Port" << ConsoleColorTag(Console_Normal) << " []: ";
|
||||
|
||||
|
@ -489,7 +489,7 @@ wizard_ticket:
|
|||
boost::algorithm::to_lower(answer);
|
||||
|
||||
String bind_port = answer;
|
||||
bind_port.Trim();
|
||||
bind_port = bind_port.Trim();
|
||||
|
||||
/* api feature is always enabled, check above */
|
||||
String apipath = FeatureUtility::GetFeaturesAvailablePath() + "/api.conf";
|
||||
|
|
|
@ -269,8 +269,7 @@ void LegacyTimePeriod::ParseTimeRange(const String& timerange, tm *begin, tm *en
|
|||
size_t pos = def.FindFirstOf('/');
|
||||
|
||||
if (pos != String::NPos) {
|
||||
String strStride = def.SubStr(pos + 1);
|
||||
strStride.Trim();
|
||||
String strStride = def.SubStr(pos + 1).Trim();
|
||||
*stride = Convert::ToLong(strStride);
|
||||
|
||||
/* Remove the stride parameter from the definition. */
|
||||
|
@ -283,11 +282,9 @@ void LegacyTimePeriod::ParseTimeRange(const String& timerange, tm *begin, tm *en
|
|||
pos = def.Find("- ");
|
||||
|
||||
if (pos != String::NPos) {
|
||||
String first = def.SubStr(0, pos);
|
||||
first.Trim();
|
||||
String first = def.SubStr(0, pos).Trim();
|
||||
|
||||
String second = def.SubStr(pos + 1);
|
||||
second.Trim();
|
||||
String second = def.SubStr(pos + 1).Trim();
|
||||
|
||||
ParseTimeSpec(first, begin, NULL, reference);
|
||||
|
||||
|
|
|
@ -136,11 +136,8 @@ Dictionary::Ptr LivestatusLogUtility::GetAttributes(const String& text)
|
|||
size_t colon = text.FindFirstOf(':');
|
||||
size_t colon_offset = colon - 13;
|
||||
|
||||
String type = String(text.SubStr(13, colon_offset));
|
||||
String options = String(text.SubStr(colon + 1));
|
||||
|
||||
type.Trim();
|
||||
options.Trim();
|
||||
String type = String(text.SubStr(13, colon_offset)).Trim();
|
||||
String options = String(text.SubStr(colon + 1)).Trim();
|
||||
|
||||
bag->Set("type", type);
|
||||
bag->Set("options", options);
|
||||
|
|
|
@ -154,9 +154,7 @@ LivestatusQuery::LivestatusQuery(const std::vector<String>& lines, const String&
|
|||
|
||||
//OutputFormat:json or OutputFormat: json
|
||||
if (line.GetLength() > col_index + 1)
|
||||
params = line.SubStr(col_index + 1);
|
||||
|
||||
params.Trim();
|
||||
params = line.SubStr(col_index + 1).Trim();
|
||||
|
||||
if (header == "ResponseHeader")
|
||||
m_ResponseHeader = params;
|
||||
|
|
|
@ -67,8 +67,8 @@ void PluginCheckTask::ProcessFinishedHandler(const Checkable::Ptr& checkable, co
|
|||
<< pr.ExitStatus << ", output: " << pr.Output;
|
||||
}
|
||||
|
||||
String output = pr.Output;
|
||||
output.Trim();
|
||||
String output = pr.Output.Trim();
|
||||
|
||||
std::pair<String, String> co = PluginUtility::ParseCheckOutput(output);
|
||||
cr->SetCommand(commandLine);
|
||||
cr->SetOutput(co.first);
|
||||
|
|
|
@ -243,14 +243,13 @@ String ConfigModuleUtility::GetActiveStage(const String& moduleName)
|
|||
|
||||
String stage;
|
||||
std::getline(fp, stage.GetData());
|
||||
stage.Trim();
|
||||
|
||||
fp.close();
|
||||
|
||||
if (fp.fail())
|
||||
return "";
|
||||
|
||||
return stage;
|
||||
return stage.Trim();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -82,11 +82,9 @@ bool HttpRequest::Parse(const Stream::Ptr& stream, StreamReadContext& src, bool
|
|||
String::SizeType pos = line.FindFirstOf(":");
|
||||
if (pos == String::NPos)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid HTTP request"));
|
||||
String key = line.SubStr(0, pos);
|
||||
boost::algorithm::to_lower(key);
|
||||
key.Trim();
|
||||
String value = line.SubStr(pos + 1);
|
||||
value.Trim();
|
||||
String key = line.SubStr(0, pos).ToLower().Trim();
|
||||
|
||||
String value = line.SubStr(pos + 1).Trim();
|
||||
Headers->Set(key, value);
|
||||
|
||||
if (key == "x-http-method-override")
|
||||
|
|
|
@ -63,20 +63,16 @@ BOOST_AUTO_TEST_CASE(append)
|
|||
BOOST_AUTO_TEST_CASE(trim)
|
||||
{
|
||||
String s1 = "hello";
|
||||
s1.Trim();
|
||||
BOOST_CHECK(s1 == "hello");
|
||||
BOOST_CHECK(s1.Trim() == "hello");
|
||||
|
||||
String s2 = " hello";
|
||||
s2.Trim();
|
||||
BOOST_CHECK(s2 == "hello");
|
||||
BOOST_CHECK(s2.Trim() == "hello");
|
||||
|
||||
String s3 = "hello ";
|
||||
s3.Trim();
|
||||
BOOST_CHECK(s3 == "hello");
|
||||
BOOST_CHECK(s3.Trim() == "hello");
|
||||
|
||||
String s4 = " hello ";
|
||||
s4.Trim();
|
||||
BOOST_CHECK(s4 == "hello");
|
||||
BOOST_CHECK(s4.Trim() == "hello");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(contains)
|
||||
|
|
Loading…
Reference in New Issue