1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

feature #575: Error message is now a vector attribute

This commit is contained in:
Ruben S. Montero 2011-04-22 01:05:40 +02:00
parent dfc858a23a
commit 4929de32ba

View File

@ -112,12 +112,12 @@ int PoolObjectSQL::drop(SqlDB *db)
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
const char * PoolObjectSQL::error_attribute_name = "ERROR_MESSAGE";
const char * PoolObjectSQL::error_attribute_name = "ERROR";
void PoolObjectSQL::set_template_error_message(const string& message)
{
SingleAttribute * attr;
ostringstream error;
VectorAttribute * attr;
map<string,string> error_value;
char str[26];
time_t the_time;
@ -129,12 +129,13 @@ void PoolObjectSQL::set_template_error_message(const string& message)
#else
ctime_r(&(the_time),str);
#endif
// Get rid of final enter character
str[24] = '\0';
error << str << ": " << message;
str[24] = '\0'; // Get rid of final enter character
attr = new SingleAttribute(error_attribute_name,error.str());
error_value.insert(make_pair("TIME_STAMP",str));
error_value.insert(make_pair("MESSAGE",message));
attr = new VectorAttribute(error_attribute_name,error_value);
obj_template->set(attr);
}