mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-27 07:34:15 +02:00
parent
3f032692ce
commit
44d961f119
@ -42,20 +42,30 @@ using namespace icinga;
|
|||||||
|
|
||||||
Dictionary::Ptr RepositoryUtility::GetArgumentAttributes(const std::vector<std::string>& arguments)
|
Dictionary::Ptr RepositoryUtility::GetArgumentAttributes(const std::vector<std::string>& arguments)
|
||||||
{
|
{
|
||||||
Dictionary::Ptr attr = make_shared<Dictionary>();
|
Dictionary::Ptr attrs = make_shared<Dictionary>();
|
||||||
|
|
||||||
BOOST_FOREACH(const String& kv, arguments) {
|
BOOST_FOREACH(const String& kv, arguments) {
|
||||||
std::vector<String> tokens;
|
std::vector<String> tokens;
|
||||||
boost::algorithm::split(tokens, kv, boost::is_any_of("="));
|
boost::algorithm::split(tokens, kv, boost::is_any_of("="));
|
||||||
|
|
||||||
if (tokens.size() == 2) {
|
if (tokens.size() != 2) {
|
||||||
attr->Set(tokens[0], tokens[1]);
|
|
||||||
} else
|
|
||||||
Log(LogWarning, "cli")
|
Log(LogWarning, "cli")
|
||||||
<< "Cannot parse passed attributes: " << boost::algorithm::join(tokens, "=");
|
<< "Cannot parse passed attributes: " << boost::algorithm::join(tokens, "=");
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return attr;
|
Value value;
|
||||||
|
|
||||||
|
try {
|
||||||
|
value = Convert::ToDouble(tokens[1]);
|
||||||
|
} catch (...) {
|
||||||
|
value = tokens[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
attrs->Set(tokens[0], value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return attrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
String RepositoryUtility::GetRepositoryConfigPath(void)
|
String RepositoryUtility::GetRepositoryConfigPath(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user