1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-23 17:33:56 +03:00

feature #3157: Do not remove existing auth files

This commit is contained in:
Ruben S. Montero 2015-01-30 20:58:00 +01:00
parent f0c94e373b
commit 61da79ee40
2 changed files with 15 additions and 4 deletions

View File

@ -565,7 +565,7 @@ void Nebula::start(bool bootstrap_only)
} }
catch (exception&) catch (exception&)
{ {
throw; throw runtime_error("Error Initializing OpenNebula pools");
} }

View File

@ -90,8 +90,6 @@ UserPool::UserPool(SqlDB * db,
throw("Database has not been bootstrapped with master data."); throw("Database has not been bootstrapped with master data.");
} }
oneadmin_name = oneadmin_user->get_name();
oneadmin_user->unlock(); oneadmin_user->unlock();
return; return;
@ -169,6 +167,13 @@ UserPool::UserPool(SqlDB * db,
for (i=0 ; i < 5; i++) for (i=0 ; i < 5; i++)
{ {
struct stat file_stat;
if ( stat(filenames[i].c_str(), &file_stat) == 0 )
{
goto erro_exists;
}
int cfile = creat(filenames[i].c_str(), S_IRUSR | S_IWUSR); int cfile = creat(filenames[i].c_str(), S_IRUSR | S_IWUSR);
close(cfile); close(cfile);
@ -240,6 +245,12 @@ error_no_open:
oss << "Could not create configuration file "<< filenames[i]; oss << "Could not create configuration file "<< filenames[i];
goto error_common; goto error_common;
erro_exists:
oss << "Password file " << filenames[i] << " already exists "
<< "but OpenNebula is boostraping the database. Check your "
<< "database configuration in oned.conf.";
goto error_common;
error_oneadmin: error_oneadmin:
oss << "Error creating oneadmin user: " << error_str; oss << "Error creating oneadmin user: " << error_str;
goto error_common; goto error_common;
@ -249,7 +260,7 @@ error_serveradmin:
error_common: error_common:
NebulaLog::log("ONE",Log::ERROR,oss); NebulaLog::log("ONE",Log::ERROR,oss);
throw; throw runtime_error(oss.str());
} }
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */