feature #3157: Do not remove existing auth files

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

No files matched your search

+1 -1
View File
@@ -565,7 +565,7 @@ void Nebula::start(bool bootstrap_only)
}
catch (exception&)
{
throw;
throw runtime_error("Error Initializing OpenNebula pools");
}
+14 -3
View File
@@ -90,8 +90,6 @@ UserPool::UserPool(SqlDB * db,
throw("Database has not been bootstrapped with master data.");
}
oneadmin_name = oneadmin_user->get_name();
oneadmin_user->unlock();
return;
@@ -169,6 +167,13 @@ UserPool::UserPool(SqlDB * db,
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);
close(cfile);
@@ -240,6 +245,12 @@ error_no_open:
oss << "Could not create configuration file "<< filenames[i];
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:
oss << "Error creating oneadmin user: " << error_str;
goto error_common;
@@ -249,7 +260,7 @@ error_serveradmin:
error_common:
NebulaLog::log("ONE",Log::ERROR,oss);
throw;
throw runtime_error(oss.str());
}
/* -------------------------------------------------------------------------- */