puppetlabs / puppetlabs/puppet-resource_api
autorelations can't handle array-valued attributes
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 27
- Forks
- 42
- PR merge metrics
- No merged PRs in 30d
Description
Describe the Bug
When using the regular autorequire to attribute value expression, like this:
diff --git a/lib/puppet/type/panos_address_group.rb b/lib/puppet/type/panos_address_group.rb
--
index 97a6cf4..e12e47d 100644
--- a/lib/puppet/type/panos_address_group.rb
+++ b/lib/puppet/type/panos_address_group.rb
@@ -54,4 +54,7 @@ DESC
autobefore: {
panos_commit: 'commit',
},
+ autorequire: {
+ panos_address: '$static_members',
+ }
)
where static_members is an array, the relation is set up to use the full array as title. Since titles can only be strings, this is wrong, and will lead to no actual relations being set up.
Expected Behavior
Defining an automatic relation based on an array-valued attribute should treat each element of the array as a potential relationship target.
Additional Context
This was originally reported as https://tickets.puppetlabs.com/browse/PDK-1094 - see there for additional logs & details.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Use the example in lib/puppet/type/panos_address_group.rb to reproduce the autorelation behavior with an array-valued static_members attribute. Trace the autorequire handling and its existing tests, if present. Done means each array element can be used as an individual relationship target rather than the whole array.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100