Skip to content

Conversation

@binford2k
Copy link
Contributor

@binford2k binford2k commented Oct 15, 2025

Before this change, values returned from a deferred function would be
wrapped inside an array when resolved lazily (with the default setting
preprocess_deferred=false.) The resolution functions didn't detect
this and the value was not resolved before the resource was enforced.

That error case didn't occur when preprocessing, which just enumerated
all values and resolved them before entering the enforcement lifecycle.

This change just avoids wrapping in an extra array. It expects the
function itself to return an array and will fail with an appropriate
error during catalog enforcement if it does not.

Error example:

Notice: Compiled catalog for waffles.localdomain in environment production in 0.01 seconds
Error: Failed to apply catalog: value returned from function 'expand_groups' has wrong type, expects an Array value, got Integer

Fixes #213

Before this change, values returned from a deferred function would be
wrapped inside an array when resolved lazily (with the default setting
`preprocess_deferred=false`.) The resolution functions didn't detect
this and the value was not resolved before the resource was enforced.

That error case  didn't occur when preprocessing, which just enumerated
all values and resolved them before entering the resolution lifecycle.

This change just avoids wrapping in an extra array. It expects the
function itself to return an array and will fail with an appropriate
error during catalog enforcement if it does not.

Example:
```
Notice: Compiled catalog for waffles.localdomain in environment production in 0.01 seconds
Error: Failed to apply catalog: value returned from function 'expand_groups' has wrong type, expects an Array value, got Integer
```

Fixes OpenVoxProject#213
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: using Deferred values in group resources fails when preprocess_deferred = false

1 participant