diff --git a/CHANGELOG.md b/CHANGELOG.md index c00d2b0..c78d195 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added +- add add "__skipThisObject" attribute to skip objects while performing `update` command ### Fixed ## [1.1.5] - 2022-02-07 diff --git a/README.md b/README.md index 0ba6d37..511cf4d 100644 --- a/README.md +++ b/README.md @@ -189,6 +189,8 @@ the "default" VPN or the VPN of the Solace Cloud Service instance, since you can only update them. Configuration file + --no-delete Do NOT perform DELETE actions, only new objects and update + existed objects ``` ## Opaque Password diff --git a/src/main/java/com/solace/tools/solconfig/model/ConfigObject.java b/src/main/java/com/solace/tools/solconfig/model/ConfigObject.java index 525050d..d1ada34 100644 --- a/src/main/java/com/solace/tools/solconfig/model/ConfigObject.java +++ b/src/main/java/com/solace/tools/solconfig/model/ConfigObject.java @@ -370,13 +370,11 @@ public void generateUpdateCommands(ConfigObject newObj, newObj.attributes.put(SempSpec.ENABLED_ATTRIBUTE_NAME, false); } - if ((boolean) newObj.attributes.getOrDefault(SempSpec.SKIP_THIS_OBJECT, false)) { - System.out.println("HAHA"); - } - - if (!attributes.entrySet().equals(newObj.attributes.entrySet())) { - var payload = newObj.toJsonStringAttributeOnly(); - updateCommandList.append(HTTPMethod.PUT, objectPath, payload); + if (! (boolean) newObj.attributes.getOrDefault(SempSpec.SKIP_THIS_OBJECT, false)) { + if (!attributes.entrySet().equals(newObj.attributes.entrySet())) { + var payload = newObj.toJsonStringAttributeOnly(); + updateCommandList.append(HTTPMethod.PUT, objectPath, payload); + } } for (int i = 0; i < oldChildren.size(); i++) { diff --git a/src/main/java/com/solace/tools/solconfig/model/SempSpec.java b/src/main/java/com/solace/tools/solconfig/model/SempSpec.java index f5d36c6..a768a8a 100644 --- a/src/main/java/com/solace/tools/solconfig/model/SempSpec.java +++ b/src/main/java/com/solace/tools/solconfig/model/SempSpec.java @@ -7,7 +7,7 @@ import java.util.stream.Collectors; public class SempSpec { - public static final String SKIP_THIS_OBJECT = "skipThisObject"; + public static final String SKIP_THIS_OBJECT = "__skipThisObject"; public static final String BROKER_SPEC_PATH = ""; public static final String SEMP_VERSION = "sempVersion"; public static final String OPAQUE_PASSWORD = "opaquePassword"; @@ -111,6 +111,7 @@ private static SempSpec of(String parentObjectPath, String collectionName) { spec.childrenNames = jsonSpec.getChildrenNames(objectPath); spec.sempClassName = jsonSpec.getSempClassName(collectionPath); spec.attributeCombinations = jsonSpec.findAttributesCombinations(collectionPath); + spec.attributes.get(AttributeType.ALL.toString()).add(SempSpec.SKIP_THIS_OBJECT); return spec; }