You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's an asymmetrical experience in ConfigGroup vs ConfigFile when it comes to the handling of non-existent files. ConfigFile produces an error, whereas ConfigGroup doesn't because the latter interprets all paths as patterns. For example, consider this program:
I feel that the behavior of the two resources should be consistent when manifest.yaml is non-existent, but in actuality the ConfigGroup would silently produce no children, which the program author probably didn't intend.
My proposal is to detect whether a given file entry is a pattern, by looking for the characters ‘*’, ‘?’, and ‘[’ as is done in Bash filename expansion.
The text was updated successfully, but these errors were encountered:
<!--Thanks for your contribution. See [CONTRIBUTING](CONTRIBUTING.md)
for Pulumi's contribution guidelines.
Help us merge your changes more quickly by adding more details such
as labels, milestones, and reviewers.-->
### Proposed changes
<!--Give us a brief description of what you've done and what it solves.
-->
This PR teaches `ConfigGroup` to detect whether a given file path is a
glob pattern, to make the handling of non-existent files be consistent
w.r.t `ConfigFile`. In other words, `*.yaml` MAY match a file whereas
`manifest.yaml` MUST match a file.
The detection code looks for special characters '*', '?', and '[' and
respects the escape syntax. Intended to be consistent with:
[https://pkg.go.dev/path/filepath#Match](https://pkg.go.dev/path/filepath#Match)
An alternative to doing pattern detection would be:
1. to expose a `glob` property to toggle globbing, or
2. a `patterns` property alongside the `files` property for patterns and
non-patterns respectively
### Related issues (optional)
<!--Refer to related PRs or issues: #1234, or 'Fixes#1234' or 'Closes#1234'.
Or link to full URLs to issues or pull requests in other GitHub
repositories. -->
Closes#2871
There's an asymmetrical experience in
ConfigGroup
vsConfigFile
when it comes to the handling of non-existent files.ConfigFile
produces an error, whereasConfigGroup
doesn't because the latter interprets all paths as patterns. For example, consider this program:I feel that the behavior of the two resources should be consistent when
manifest.yaml
is non-existent, but in actuality theConfigGroup
would silently produce no children, which the program author probably didn't intend.My proposal is to detect whether a given file entry is a pattern, by looking for the characters ‘*’, ‘?’, and ‘[’ as is done in Bash filename expansion.
The text was updated successfully, but these errors were encountered: