1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-22 13:33:52 +03:00

feature #4217: Add imported apps to the associated marketplace

This commit is contained in:
Ruben S. Montero 2016-02-09 20:47:04 +01:00
parent f75c009ef9
commit dd71246884
3 changed files with 16 additions and 3 deletions

View File

@ -67,7 +67,8 @@ public:
* @param mp_name of the MarketPlace
* @param error_str Returns the error reason, if any
*
* @return 0 on success
* @return the oid assigned to the object, -1 in case of failure, -2
* already imported
*/
int import(const std::string& t64, int mp_id, const std::string& mp_name,
std::string& error_str);

View File

@ -144,7 +144,7 @@ int MarketPlaceAppPool::import(const std::string& t64, int mp_id,
{
//Marketplace app already imported
delete app;
return 0;
return -2;
}
return PoolSQL::allocate(app, error_str);

View File

@ -143,10 +143,22 @@ static void monitor_action(
for (int i=0; i< num ; i++)
{
if ( apppool->import(apps[i]->value(), id, name, err) == -1 )
int rc = apppool->import(apps[i]->value(), id, name, err);
if ( rc == -1 )
{
NebulaLog::log("MKP", Log::ERROR, "Error importing app: " + err);
}
else if ( rc >= 0 ) //-2 means app already imported
{
MarketPlace * market = marketpool->get(id, true);
market->add_marketapp(rc);
marketpool->update(market);
market->unlock();
}
}
oss << "Marketplace " << name << " (" << id << ") successfully monitored.";