diff --git a/gradle.properties b/gradle.properties index e529fee9..d7c16c05 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,4 +16,4 @@ group=com.nike artifactId=cerberus-lifecycle-cli -version=4.7.0 +version=4.7.1 diff --git a/src/main/java/com/nike/cerberus/command/cms/UpdateCmsConfigCommand.java b/src/main/java/com/nike/cerberus/command/cms/UpdateCmsConfigCommand.java index 6b36e55b..06bf4183 100644 --- a/src/main/java/com/nike/cerberus/command/cms/UpdateCmsConfigCommand.java +++ b/src/main/java/com/nike/cerberus/command/cms/UpdateCmsConfigCommand.java @@ -37,6 +37,7 @@ public class UpdateCmsConfigCommand implements Command { public static final String COMMAND_NAME = "update-cms-config"; public static final String OVERWRITE_LONG_ARG = "--overwrite"; public static final String FORCE_ARG = "--force"; + public static final String IGNORE_DEFAULT_CONFIGURATIONS_ARGUMENT = "--ignore-default-configurations"; @Parameter(names = CreateCmsConfigCommand.ADMIN_GROUP_LONG_ARG, description = "Group that has admin privileges in CMS.") private String adminGroup; @@ -50,6 +51,9 @@ public class UpdateCmsConfigCommand implements Command { @Parameter(names = FORCE_ARG, description = "Force allow overwriting of system generated property. This may break your configuration.") private boolean force = false; + @Parameter(names = IGNORE_DEFAULT_CONFIGURATIONS_ARGUMENT, description = "Ignores default configurations of the CMS. ") + private boolean ignoreDefaultConfigurations = false; + public String getAdminGroup() { return adminGroup; } @@ -66,6 +70,10 @@ public boolean isForce() { return force; } + public boolean isIgnoreDefaultConfigurations() { + return ignoreDefaultConfigurations; + } + @Override public String getCommandName() { return COMMAND_NAME; diff --git a/src/main/java/com/nike/cerberus/operation/cms/CreateCmsConfigOperation.java b/src/main/java/com/nike/cerberus/operation/cms/CreateCmsConfigOperation.java index 0881f826..63cc3f84 100644 --- a/src/main/java/com/nike/cerberus/operation/cms/CreateCmsConfigOperation.java +++ b/src/main/java/com/nike/cerberus/operation/cms/CreateCmsConfigOperation.java @@ -44,7 +44,7 @@ public CreateCmsConfigOperation(final ConfigStore configStore) { @Override public void run(final CreateCmsConfigCommand command) { logger.info("Retrieving configuration data from the configuration bucket."); - final Properties cmsConfigProperties = configStore.getCmsSystemProperties(false); + final Properties cmsConfigProperties = configStore.getCmsSystemProperties(false, false); cmsConfigProperties.put(CMS_ADMIN_GROUP_KEY, command.getAdminGroup()); diff --git a/src/main/java/com/nike/cerberus/operation/cms/UpdateCmsConfigOperation.java b/src/main/java/com/nike/cerberus/operation/cms/UpdateCmsConfigOperation.java index add18073..615d0475 100644 --- a/src/main/java/com/nike/cerberus/operation/cms/UpdateCmsConfigOperation.java +++ b/src/main/java/com/nike/cerberus/operation/cms/UpdateCmsConfigOperation.java @@ -49,7 +49,7 @@ public void run(final UpdateCmsConfigCommand command) { logger.debug("Retrieving configuration data from the configuration bucket."); - final Properties newProperties = configStore.getCmsSystemProperties(true); + final Properties newProperties = configStore.getCmsSystemProperties(true, command.isIgnoreDefaultConfigurations()); final Properties existingCustomProperties = configStore.getExistingCmsUserProperties(); if (!command.getOverwrite()) { // keep existing custom properties diff --git a/src/main/java/com/nike/cerberus/store/ConfigStore.java b/src/main/java/com/nike/cerberus/store/ConfigStore.java index 072c1e1b..27f25d87 100644 --- a/src/main/java/com/nike/cerberus/store/ConfigStore.java +++ b/src/main/java/com/nike/cerberus/store/ConfigStore.java @@ -324,8 +324,7 @@ private Properties generateBaseCmsSystemProperties() { /** * System properties not set with -P param */ - public Properties getCmsSystemProperties(boolean shouldLoadExistingProperties) { - + public Properties getCmsSystemProperties(boolean shouldLoadExistingProperties, boolean shouldIgnoreDefaultCmsProperties) { Properties properties = new Properties(); Properties existingProperties; @@ -339,8 +338,10 @@ public Properties getCmsSystemProperties(boolean shouldLoadExistingProperties) { }); } - // overwrite any of the automatically generated properties that may have changed - properties.putAll(generateBaseCmsSystemProperties()); + if (!shouldIgnoreDefaultCmsProperties) { + // overwrite any of the automatically generated properties that may have changed + properties.putAll(generateBaseCmsSystemProperties()); + } if (!properties.containsKey(HASH_SALT)) { properties.put(HASH_SALT, saltGenerator.generateSalt());