Search in sources :

Example 6 with RegistryNotFoundException

use of org.bf2.srs.fleetmanager.storage.RegistryNotFoundException in project srs-fleet-manager by bf2fc6cc711aee1a0c2a.

the class ScheduleRegistryWorker method finallyExecute.

@Override
public void finallyExecute(Task aTask, WorkerContext ctl, Optional<Exception> error) throws RegistryNotFoundException, RegistryStorageConflictException {
    ScheduleRegistryTask task = (ScheduleRegistryTask) aTask;
    // SUCCESS STATE
    Optional<RegistryData> registryOpt = storage.getRegistryById(task.getRegistryId());
    if (registryOpt.isPresent() && registryOpt.get().getRegistryDeployment() != null)
        return;
    // The only thing to handle is if we were able to schedule but storage does not work
    // In that case, the only thing to do is to just try deleting the registry.
    storage.deleteRegistry(task.getRegistryId());
}
Also used : ScheduleRegistryTask(org.bf2.srs.fleetmanager.execution.impl.tasks.ScheduleRegistryTask) RegistryData(org.bf2.srs.fleetmanager.storage.sqlPanacheImpl.model.RegistryData)

Aggregations

Transactional (javax.transaction.Transactional)4 RegistryData (org.bf2.srs.fleetmanager.storage.sqlPanacheImpl.model.RegistryData)4 DeprovisionRegistryTask (org.bf2.srs.fleetmanager.execution.impl.tasks.deprovision.DeprovisionRegistryTask)2 TenantNotFoundServiceException (org.bf2.srs.fleetmanager.spi.tenants.TenantNotFoundServiceException)2 RegistryDeploymentData (org.bf2.srs.fleetmanager.storage.sqlPanacheImpl.model.RegistryDeploymentData)2 CheckDeletePermissions (org.bf2.srs.fleetmanager.auth.interceptor.CheckDeletePermissions)1 Audited (org.bf2.srs.fleetmanager.common.operation.auditing.Audited)1 ProvisionRegistryTenantTask (org.bf2.srs.fleetmanager.execution.impl.tasks.ProvisionRegistryTenantTask)1 ScheduleRegistryTask (org.bf2.srs.fleetmanager.execution.impl.tasks.ScheduleRegistryTask)1 StartDeprovisionRegistryTask (org.bf2.srs.fleetmanager.execution.impl.tasks.deprovision.StartDeprovisionRegistryTask)1 SubscriptionNotFoundServiceException (org.bf2.srs.fleetmanager.spi.ams.SubscriptionNotFoundServiceException)1 TenantManagerConfig (org.bf2.srs.fleetmanager.spi.tenants.model.TenantManagerConfig)1 RegistryNotFoundException (org.bf2.srs.fleetmanager.storage.RegistryNotFoundException)1