Support value substitution in attribute values. - #24
Merged
Conversation
…es or tags. add existence check operator ~~
Contributor
There was a problem hiding this comment.
Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.
Files not reviewed (1)
- src/test/groovy/org/rundeck/plugins/nodes/attributes/AttributeNodeEnhancerSpec.groovy: Language not supported
Comments suppressed due to low confidence (2)
src/main/java/org/rundeck/plugins/nodes/attributes/AttributeNodeEnhancer.java:119
- The IllegalArgumentException thrown here lacks a descriptive message, which may hinder debugging. Consider adding a message detailing the cause, possibly including the IOException message.
throw new IllegalArgumentException();
src/main/java/org/rundeck/plugins/nodes/attributes/AttributeNodeEnhancer.java:84
- [nitpick] The parameter name 'addTags1' is unclear and inconsistent with similar naming elsewhere. Consider renaming it to 'addTags' to improve clarity.
public static void addAllTags(final Set<String> tags, Map<String, String> attributes, String addTags1, boolean enableSubstitution) {
Contributor
There was a problem hiding this comment.
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- src/test/groovy/org/rundeck/plugins/nodes/attributes/AttributeNodeEnhancerSpec.groovy: Language not supported
Comments suppressed due to low confidence (1)
src/main/java/org/rundeck/plugins/nodes/attributes/AttributeNodeEnhancer.java:133
- Add unit tests to cover the substitution logic, including cases with special characters and missing attribute values to ensure the new functionality behaves as expected.
private static String substitute(Map<String, String> attributes, String value) {
Attribute values containing $ or \ were interpreted as regex group references/escapes during substitution, causing errors or mangled output. Quote the replacement and add tests for special characters.
fdevans
approved these changes
Jul 10, 2026
This was referenced Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Release Notes
The Attribute Match Enhancer now supports value substitution, letting you build new tags and attribute values from a node's existing attributes (for example,
image-${ec2.imageId}). It also adds a new "is present" match operator (~~) so you can target nodes simply based on whether an attribute exists, regardless of its value.PR Details
Summary
Adds the ability to substitute existing node attribute values into newly-added attributes and tags, and introduces a new presence-check match operator.
Changes
~~"is present" operator — matches when an attribute exists (no value required), complementing the existing!!"not present" operator. Operator documentation updated to indicate which operators take no value.${attribute}syntax (e.g.tag1,image-${ec2.imageId}ornewattr=some-${oldattr}/${otherattr}). Unknown references resolve to an empty string. Disabled by default, so existing configurations are unaffected.loadedProps/loadedTags); added a descriptive message and cause to the properties-parsingIllegalArgumentException; replaced a wildcard import with explicit imports.Tests
Added Spock coverage for attribute-value substitution, tag substitution (both with substitution enabled and disabled), and a parameterized matrix validating the
~~and!!operators.