Cli: Fix integer formatting in repository command

refs #7255
This commit is contained in:
Michael Friedrich 2014-10-27 15:33:36 +01:00
parent 3f032692ce
commit 44d961f119
1 changed files with 15 additions and 5 deletions

View File

@ -42,20 +42,30 @@ using namespace icinga;
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) {
std::vector<String> tokens;
boost::algorithm::split(tokens, kv, boost::is_any_of("="));
if (tokens.size() == 2) {
attr->Set(tokens[0], tokens[1]);
} else
if (tokens.size() != 2) {
Log(LogWarning, "cli")
<< "Cannot parse passed attributes: " << boost::algorithm::join(tokens, "=");
continue;
}
Value value;
try {
value = Convert::ToDouble(tokens[1]);
} catch (...) {
value = tokens[1];
}
attrs->Set(tokens[0], value);
}
return attr;
return attrs;
}
String RepositoryUtility::GetRepositoryConfigPath(void)