Skip to content

Conversation

@michaeltlombardi
Copy link
Contributor

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. In those cases, we are choosing to fail quickly and clearly.

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.
@sanfrancrisko sanfrancrisko merged commit d15af63 into puppetlabs:master Oct 30, 2019
@michaeltlombardi michaeltlombardi deleted the ticket/master/FM-8643-rescue-requires branch October 29, 2020 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants