From 13f258fb903c042dad8fcb5994721b4a4ebcc2d8 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Wed, 11 Sep 2024 13:32:49 +0200 Subject: [PATCH] fix import with domain setup dns verification (#98) Co-authored-by: Michael Hoennig Reviewed-on: https://dev.hostsharing.net/hostsharing/hs.hsadmin.ng/pulls/98 Reviewed-by: Marc Sandlus --- .../validators/HsDomainSetupHostingAssetValidator.java | 8 +++++--- .../hsadminng/hs/migration/ImportHostingAssets.java | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/validators/HsDomainSetupHostingAssetValidator.java b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/validators/HsDomainSetupHostingAssetValidator.java index 40530ad1..20fcbf69 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/validators/HsDomainSetupHostingAssetValidator.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/validators/HsDomainSetupHostingAssetValidator.java @@ -26,9 +26,11 @@ class HsDomainSetupHostingAssetValidator extends HostingAssetEntityValidator { @Override public List validateEntity(final HsHostingAsset assetEntity) { - final var violations = // new ArrayList(); - super.validateEntity(assetEntity); - if (!violations.isEmpty()) { + final var violations = super.validateEntity(assetEntity); + if (!violations.isEmpty() || assetEntity.isLoaded()) { + // it makes no sense to do DNS-based validation + // if the entity is already persisted or + // if the identifier (domain name) or structure is already invalid return violations; } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportHostingAssets.java b/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportHostingAssets.java index 2f34ecee..d3ed3407 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportHostingAssets.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportHostingAssets.java @@ -1450,6 +1450,7 @@ public class ImportHostingAssets extends BaseOfficeDataImport { // nothing here )) .build(); + domainSetupAsset.markAsLoaded(); // to skip setup verification domainSetupsByName.put(domain_name, domainSetupAsset); domainSetupAssets.put(domain_id, domainSetupAsset); domainSetupAsset.setSubHostingAssets(new ArrayList<>());