puppetlabs / puppetlabs/puppet-resource_api

autorelations can't handle array-valued attributes

Open
#212 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.