Skip to content

Commit 1ab7fc9

Browse files
committed
improve error message for mutable nodes
1 parent 5e33868 commit 1ab7fc9

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/it/project1/verify.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
String buildLog = new File(basedir, 'build.log').text
22

33
assert buildLog.contains("[WARNING] ValidationViolation: \"netcentric-aem-cloud: Nodes below '/libs' may be overwritten by future product upgrades. Rather use '/apps'. Further details at https://experienceleague.adobe.com/docs/experience-manager-cloud-service/implementing/developing/full-stack/overlays.html?lang=en#developing\", filePath=jcr_root${File.separator}libs${File.separator}cq${File.separator}test${File.separator}test.jsp, nodePath=/libs/cq/test/test.jsp") : 'libs violation not found'
4-
assert buildLog.contains("[WARNING] ValidationViolation: \"netcentric-aem-cloud: Using mutable nodes in this repository location is not allowed as it is not writable by the underlying service user on a publish instance. Consider to use repoinit scripts instead or move that content to another location. Further details at https://experienceleague.adobe.com/docs/experience-manager-learn/cloud-service/debugging/debugging-aem-as-a-cloud-service/build-and-deployment.html?lang=en#including-%2Fvar-in-content-package\", filePath=jcr_root${File.separator}var${File.separator}example${File.separator}test.txt, nodePath=/var/example/test.txt") : 'read only path in mutable package not detected'
4+
assert buildLog.contains("[WARNING] ValidationViolation: \"netcentric-aem-cloud: Using mutable nodes in this repository location is only allowed in author-specific packages as it is not writable by the underlying service user on a publish instance. Consider to use repoinit scripts instead or move that content to another location. Further details at https://experienceleague.adobe.com/docs/experience-manager-learn/cloud-service/debugging/debugging-aem-as-a-cloud-service/build-and-deployment.html?lang=en#including-%2Fvar-in-content-package\", filePath=jcr_root${File.separator}var${File.separator}example${File.separator}test.txt, nodePath=/var/example/test.txt") : 'read only path in mutable package not detected'
55
assert buildLog.contains("[WARNING] ValidationViolation: \"netcentric-aem-cloud: Using install hooks in mutable content packages leads to deployment failures as the underlying service user on the publish does not have the right to execute those.\", filePath=META-INF${File.separator}vault${File.separator}hooks${File.separator}vault-hook-example-3.0.0.jar") : 'internal hook violation not found'
66
assert buildLog.contains("[WARNING] ValidationViolation: \"netcentric-aem-cloud: Using install hooks in mutable content packages leads to deployment failures as the underlying service user on the publish does not have the right to execute those.\", filePath=META-INF${File.separator}vault${File.separator}properties") : 'external hook violation not found'
77
assert buildLog.contains("[WARNING] ValidationViolation: \"netcentric-aem-cloud: Mutable nodes in mixed package types are not installed!\", filePath=jcr_root${File.separator}content${File.separator}example${File.separator}test.txt, nodePath=/content/example/test.txt") : 'mutable content in mixed package not found'

src/main/java/biz/netcentric/filevault/validator/aem/cloud/AemCloudValidator.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@
3838

3939
public class AemCloudValidator implements NodePathValidator, MetaInfPathValidator, DocumentViewXmlValidator, PropertiesValidator {
4040

41-
static final String VIOLATION_MESSAGE_CONDITION_AUTHOR_ONLY_CONTAINER = "only allowed in author-specific packages";
42-
static final String VIOLATION_MESSAGE_CONDITION_OVERALL = "not allowed";
43-
static final String VIOLATION_MESSAGE_READONLY_MUTABLE_PATH = "Using mutable nodes in this repository location is %s as it is not writable by the underlying service user on a publish instance. Consider to use repoinit scripts instead or move that content to another location. Further details at https://experienceleague.adobe.com/docs/experience-manager-learn/cloud-service/debugging/debugging-aem-as-a-cloud-service/build-and-deployment.html?lang=en#including-%%2Fvar-in-content-package";
41+
static final String VIOLATION_MESSAGE_READONLY_MUTABLE_PATH = "Using mutable nodes in this repository location is only allowed in author-specific packages as it is not writable by the underlying service user on a publish instance. Consider to use repoinit scripts instead or move that content to another location. Further details at https://experienceleague.adobe.com/docs/experience-manager-learn/cloud-service/debugging/debugging-aem-as-a-cloud-service/build-and-deployment.html?lang=en#including-%2Fvar-in-content-package";
4442
static final String VIOLATION_MESSAGE_INSTALL_HOOK_IN_MUTABLE_PACKAGE = "Using install hooks in mutable content packages leads to deployment failures as the underlying service user on the publish does not have the right to execute those.";
4543
static final String VIOLATION_MESSAGE_INVALID_INDEX_DEFINITION_NODE_NAME = "All Oak index definition node names must end with '-custom-<integer>' but found name '%s'. Further details at https://experienceleague.adobe.com/docs/experience-manager-cloud-service/operations/indexing.html?lang=en#how-to-use";
4644
static final String VIOLATION_MESSAGE_LIBS_NODES = "Nodes below '/libs' may be overwritten by future product upgrades. Rather use '/apps'. Further details at https://experienceleague.adobe.com/docs/experience-manager-cloud-service/implementing/developing/full-stack/overlays.html?lang=en#developing";
@@ -98,9 +96,7 @@ public Collection<ValidationMessage> validate(@NotNull String path) {
9896
// check if package itself is only used on author
9997
if (!allowReadOnlyMutablePaths && !isContainedInAuthorOnlyPackage(containerValidationContext)) {
10098
// only emit once per package
101-
messages.add(new ValidationMessage(defaultSeverity, String.format(
102-
VIOLATION_MESSAGE_READONLY_MUTABLE_PATH, allowReadOnlyMutablePaths ? VIOLATION_MESSAGE_CONDITION_AUTHOR_ONLY_CONTAINER
103-
: VIOLATION_MESSAGE_CONDITION_OVERALL)));
99+
messages.add(new ValidationMessage(defaultSeverity, VIOLATION_MESSAGE_READONLY_MUTABLE_PATH));
104100
numVarNodeViolations++;
105101
}
106102
}

0 commit comments

Comments
 (0)