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:
parent
f75c009ef9
commit
dd71246884
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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.";
|
||||
|
Loading…
Reference in New Issue
Block a user