Commit 448c3ad
committed
(FM-8643) Ensure library requires fail usefully
This commit places the requires statement for the
ruby-pwsh ruby code (found in the dependency module,
puppetlabs-pwshlib) in a begin-rescue block and adds
a loud error message that points at the solution.
This will cause the loading of the providers to still
fail during autoloading, but to do so usefully.
We chose not to use the feature/confine pattern
because it is not supported by the resource_api, the
primary interface through which we expect community
members to write types and providers in the future.
We chose not to use a utility loader method, which
would have prevented breaking during autoloading,
because of the friction and additional complexity
cost incurred for every module needing to adopt
this pattern.
While this rescued-requires pattern will still
cause an error during autoloading, this should
only be possible in cases where the module is
being installed from github and the dependency
chain is not installed.1 parent 9dea688 commit 448c3ad
File tree
3 files changed
+14
-5
lines changed- lib/puppet/provider/exec
3 files changed
+14
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
3 | 7 | | |
4 | 8 | | |
5 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
3 | 7 | | |
4 | 8 | | |
5 | 9 | | |
| |||
0 commit comments