Open DavidS opened 4 years ago
We're about to ship FFI in all agent platforms again, so this might be easier in the near future.
+1
Anything happening with this issue? Its pretty crazy that such an important wrapper from the low level api was not implemented in the new-and improved simplified api. I have been searching high and low for examples that run local command but every example I saw used net::http to call a web api, not a single one that ran a local binary!!
Is there any update? I am maintaining a puppet module that I wrote quite a while ago (for puppet 3) and I was thinking about porting my type/provider to the resource API as I thought the old interface was discouraged (supported by the fact that pdk new provider
provides a skeleton for the resource API)
Right now the documentation of the resource API explains the concept on two examples yum and apt and they both don't show how running local commands are implemented. The APT example simply shows a single function call
@apt_key_cmd.run(context, action, key_id)
without showing where @apt_key_cmd.run
comes from nor what the function signature actually is.
If this is not possible right now is it fair to assume that the Resource API is targeted against devices (which are managed through transports), not local providers?
Use Case
Local providers need to execute commands to inspect and manage local resources.
Describe the Solution You Would Like
There was a
Commands
API in early versions of the Resource API, which ticked a number of boxes around ease-of-use, safety, platform-awareness, and integration with Resource API patterns. That iteration was built on thechildprocess
gem which - due to its dependency on FFI - was not acceptable to ship in the puppet agent.Having a dedicated Resource API layer would also enable us to do advanced checks like verifying noop-correctness (see PDK-565 for examples).
Describe Alternatives You've Considered
exec
/open3
directly. steep learning curve, easy to misuse, especially on windows.Puppet::Util::Execution
.Additional Context
Originally filed as https://tickets.puppetlabs.com/browse/PDK-847 .
@kreeuwijk said