mirror of
https://github.com/OpenNebula/one.git
synced 2025-02-04 17:47:00 +03:00
Feature #687: Add the ACL Manager to the test Nebula class
This commit is contained in:
parent
b9eae8bfbf
commit
3db9d55684
@ -35,6 +35,7 @@
|
||||
#include "RequestManager.h"
|
||||
#include "HookManager.h"
|
||||
#include "AuthManager.h"
|
||||
#include "AclManager.h"
|
||||
#include "ImageManager.h"
|
||||
|
||||
class NebulaTest
|
||||
@ -49,7 +50,7 @@ protected:
|
||||
need_im(false), need_tm(false),
|
||||
need_lcm(false), need_dm(false),
|
||||
need_rm(false), need_hm(false),
|
||||
need_authm(false), need_imagem(false)
|
||||
need_authm(false), need_aclm(false), need_imagem(false)
|
||||
{};
|
||||
|
||||
virtual ~NebulaTest(){};
|
||||
@ -75,6 +76,7 @@ public:
|
||||
bool need_rm;
|
||||
bool need_hm;
|
||||
bool need_authm;
|
||||
bool need_aclm;
|
||||
bool need_imagem;
|
||||
|
||||
static NebulaTest * instance()
|
||||
@ -132,6 +134,8 @@ public:
|
||||
|
||||
virtual AuthManager* create_authm(time_t timer_period);
|
||||
|
||||
virtual AclManager* create_aclm(SqlDB* db);
|
||||
|
||||
virtual ImageManager* create_imagem(ImagePool * ipool);
|
||||
};
|
||||
|
||||
|
@ -132,6 +132,11 @@ void Nebula::start()
|
||||
delete authm;
|
||||
}
|
||||
|
||||
if ( aclm != 0)
|
||||
{
|
||||
delete aclm;
|
||||
}
|
||||
|
||||
if ( nebula_configuration != 0)
|
||||
{
|
||||
delete nebula_configuration;
|
||||
@ -178,6 +183,7 @@ void Nebula::start()
|
||||
ImagePool::bootstrap(db);
|
||||
VMTemplatePool::bootstrap(db);
|
||||
GroupPool::bootstrap(db);
|
||||
AclManager::bootstrap(db);
|
||||
}
|
||||
catch (exception&)
|
||||
{
|
||||
@ -235,9 +241,6 @@ void Nebula::start()
|
||||
throw;
|
||||
}
|
||||
|
||||
// Set pointer to null, to prevent its deletion on the destructor
|
||||
db = 0;
|
||||
|
||||
// -----------------------------------------------------------
|
||||
//Managers
|
||||
// -----------------------------------------------------------
|
||||
@ -368,30 +371,6 @@ void Nebula::start()
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Request Manager ----
|
||||
if (tester->need_rm)
|
||||
{
|
||||
try
|
||||
{
|
||||
rm = tester->create_rm(log_location + "one_xmlrpc.log");
|
||||
}
|
||||
catch (bad_alloc&)
|
||||
{
|
||||
NebulaLog::log("ONE", Log::ERROR, "Error starting RM");
|
||||
throw;
|
||||
}
|
||||
|
||||
if( rm != 0 )
|
||||
{
|
||||
rc = rm->start();
|
||||
}
|
||||
|
||||
if ( rc != 0 )
|
||||
{
|
||||
throw runtime_error("Could not start the Request Manager");
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Hook Manager ----
|
||||
if (tester->need_hm)
|
||||
{
|
||||
@ -438,6 +417,26 @@ void Nebula::start()
|
||||
}
|
||||
}
|
||||
|
||||
// ---- ACL Manager ----
|
||||
if (tester->need_aclm)
|
||||
{
|
||||
try
|
||||
{
|
||||
aclm = new AclManager(db);
|
||||
}
|
||||
catch (bad_alloc&)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
rc = aclm->start();
|
||||
|
||||
if ( rc != 0 )
|
||||
{
|
||||
throw runtime_error("Could not start the ACL Manager");
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Image Manager ----
|
||||
if (tester->need_imagem)
|
||||
{
|
||||
@ -461,6 +460,30 @@ void Nebula::start()
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Request Manager ----
|
||||
if (tester->need_rm)
|
||||
{
|
||||
try
|
||||
{
|
||||
rm = tester->create_rm(log_location + "one_xmlrpc.log");
|
||||
}
|
||||
catch (bad_alloc&)
|
||||
{
|
||||
NebulaLog::log("ONE", Log::ERROR, "Error starting RM");
|
||||
throw;
|
||||
}
|
||||
|
||||
if( rm != 0 )
|
||||
{
|
||||
rc = rm->start();
|
||||
}
|
||||
|
||||
if ( rc != 0 )
|
||||
{
|
||||
throw runtime_error("Could not start the Request Manager");
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// Load mads
|
||||
// -----------------------------------------------------------
|
||||
@ -496,6 +519,11 @@ void Nebula::start()
|
||||
{
|
||||
authm->load_mads(0);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// Set DB pointer to null, to prevent its deletion on the destructor
|
||||
// -----------------------------------------------------------
|
||||
db = 0;
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
@ -139,6 +139,11 @@ AuthManager* NebulaTest::create_authm(time_t timer_period)
|
||||
return 0;
|
||||
}
|
||||
|
||||
AclManager* NebulaTest::create_aclm(SqlDB* db)
|
||||
{
|
||||
return new AclManager(db);
|
||||
}
|
||||
|
||||
ImageManager* NebulaTest::create_imagem(ImagePool * ipool)
|
||||
{
|
||||
map<string,string> mad_value;
|
||||
|
Loading…
x
Reference in New Issue
Block a user