ArtifactRepository made optional for JpaSystemManagement (#2019)

- it's needed only when on Mgmt instance

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-11-12 14:25:14 +02:00
committed by GitHub
parent cf5b91cfd3
commit 714eb8b6ed

View File

@@ -116,7 +116,7 @@ public class JpaSystemManagement implements CurrentTenantCacheKeyGenerator, Syst
private PlatformTransactionManager txManager; private PlatformTransactionManager txManager;
@Autowired @Autowired
private RolloutStatusCache rolloutStatusCache; private RolloutStatusCache rolloutStatusCache;
@Autowired @Autowired(required = false) // it's not required on dmf/ddi only instances
private ArtifactRepository artifactRepository; private ArtifactRepository artifactRepository;
@Autowired @Autowired
private RepositoryProperties repositoryProperties; private RepositoryProperties repositoryProperties;
@@ -156,6 +156,10 @@ public class JpaSystemManagement implements CurrentTenantCacheKeyGenerator, Syst
@Retryable(include = { @Retryable(include = {
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY)) ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
public void deleteTenant(final String t) { public void deleteTenant(final String t) {
if (artifactRepository == null) {
throw new IllegalStateException("Artifact repository is not available. Can't delete tenant.");
}
final String tenant = t.toUpperCase(); final String tenant = t.toUpperCase();
cacheManager.evictCaches(tenant); cacheManager.evictCaches(tenant);
rolloutStatusCache.evictCaches(tenant); rolloutStatusCache.evictCaches(tenant);